local loggedSoloLaunch = false
local soloLaunchActive = false
local loggedSalvageSetup = false
local heistToolMenu = menu.add_menu("抢劫工具V1.1.6", "heist_tool")
local cayoMenu = menu.add_submenu(heistToolMenu, "佩里克岛抢劫任务")
local cayoprepsMenu = menu.add_submenu(cayoMenu, "准备选项")
local cayoCutsMenu = menu.add_submenu(cayoMenu,"抢劫分红")
local cayotoolsMenu = menu.add_submenu(cayoMenu,"抢劫工具")
local difficultyMenu = menu.add_submenu(cayoprepsMenu, "难度")
local approachMenu = menu.add_submenu(cayoprepsMenu, "上岛方式")
local targetMenu = menu.add_submenu(cayoprepsMenu, "主要目标")
local secondaryMenu = menu.add_submenu(cayoprepsMenu, "次要目标")
local islandTargetMenu = menu.add_submenu(cayoprepsMenu, "岛上目标")
local loadoutMenu = menu.add_submenu(cayoprepsMenu, "武器装备")
local LootOptionsMenu = menu.add_submenu(cayoprepsMenu, "战利品选项")
local compoundAmountMenu = menu.add_submenu(LootOptionsMenu, "数量复合战利品")
local islandAmountMenu = menu.add_submenu(LootOptionsMenu, "岛屿战利品数量")
local artsAmountMenu = menu.add_submenu(LootOptionsMenu, "艺术数量 ")
local agencyMenu = menu.add_submenu(heistToolMenu, "事务所")
local agencyPrepsMenu = menu.add_submenu(agencyMenu, "准备选项 ")
local autoshopHeistMenu = menu.add_submenu(heistToolMenu, "改装铺")
local autoshopPrepsMenu = menu.add_submenu(autoshopHeistMenu, "准备选项 ")
local autoshopmoneyMenu = menu.add_submenu(autoshopHeistMenu, "分红选项")
local autoshopToolMenu = menu.add_submenu(autoshopHeistMenu, "抢劫工具 ")
local autoshopcontractsmenu = menu.add_submenu(autoshopPrepsMenu, "选择任务 ")
local salvageMenu = menu.add_submenu(heistToolMenu, "回收站")
local casinoHeistMenu = menu.add_submenu(heistToolMenu, "赌场抢劫任务")
local doomsHeistMenu = menu.add_submenu(heistToolMenu, "末日抢劫任务")
local classicHeistMenu = menu.add_submenu(heistToolMenu, "经典抢劫任务 ")
local contractsMenu = menu.add_submenu(agencyPrepsMenu, "跳过前置任务 ")
local agencyToolsMenu = menu.add_submenu(agencyMenu, "抢劫工具 ")
local salvagePrepsMenu = menu.add_submenu(salvageMenu, "准备选项 ")
local salvageToolsMenu = menu.add_submenu(salvageMenu, "抢劫工具 ")
local classicPrepsMenu = menu.add_submenu(classicHeistMenu, "抢劫准备选项 ")
local classicCutsMenu = menu.add_submenu(classicHeistMenu, "队伍功能 ")
local classicToolsMenu = menu.add_submenu(classicHeistMenu, "抢劫工具 ")
local doomspresetMenu = menu.add_submenu(doomsHeistMenu, "末日准备预 ") 
local doomsCutsMenu = menu.add_submenu(doomsHeistMenu, "末日预设分红 ")
local doomsToolsMenu = menu.add_submenu(doomsHeistMenu, "末日抢劫具 ")
local doomscutspresetMenu = menu.add_submenu(doomsCutsMenu, "Automated Doomsday Payout")
local presetsMenu = menu.add_submenu(casinoHeistMenu, "赌场准备预设 ")
local cutsMenu = menu.add_submenu(casinoHeistMenu, "赌场预设分红 ")
local toolsMenu = menu.add_submenu(casinoHeistMenu, "赌场抢劫工具 ")

-- Thanks to @Elfish-Tweaker for optimising this script <3


menu.add_toggle(heistToolMenu, "单人可开启所有任务", false, function(state)
    soloLaunchEnabled = state

    if not state then
        notification.show("单人开任务已禁用")
        loggedSoloLaunch = false
    else
        loggedSoloLaunch = false -- force the loop to re-evaluate session state and show proper message
    end
end)



script.register_looped(function()
    if soloLaunchEnabled then
        if NETWORK.NETWORK_IS_IN_SESSION() and script.is_active("fmmc_launcher") then 		-- Play Alone should be studied lol (check the locals and globals)
            
            locals.set_int("fmmc_launcher", 19992 + 15, 1)

            local step2 = locals.get_int("fmmc_launcher", 20026)
            if step2 then
                local idx = 794954 + 4 + 1 + (step2 * 95) + 75
                globals.set_int(idx, 1)
            end

            globals.set_int(4722131, 1)
            globals.set_int(4722132, 1)
            globals.set_int(4722135, 1)
            globals.set_int(4909100, 0)

            if not loggedSoloLaunch then
                notification.show("启用单人开任务, 不建议和BE一起开!")
                loggedSoloLaunch = true
            end
        else
            -- disable when not in session
            if soloLaunchEnabled and not NETWORK.NETWORK_IS_IN_SESSION() then
                notification.show("单人开任务已禁用, 加入一个战局以启用!")
            end
            loggedSoloLaunch = false
        end
    else
        loggedSoloLaunch = false
    end

    -- script.sleep(1000)
end)




menu.add_action(casinoHeistMenu, "预设最高分红 3,619,000$ ")
--skips Arcade setup
menu.add_action(casinoHeistMenu, "跳过游戏厅前置", function()
    STATS.SET_PACKED_STAT_BOOL_CODE(27227, true, 1)
	STATS.SET_PACKED_STAT_BOOL_CODE(27227, true, 0)

    STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    notification.show("游戏厅前置已完成, 请切换战局以应用!")
end)

-- Add Silent & Sneaky approach im 2 lazy to make it shorter
menu.add_action(presetsMenu, "隐秘潜入", function()

    local stat0, stat1

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_MASKS")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_MASKS")
    STATS.STAT_SET_INT(stat0, 4, true)
    STATS.STAT_SET_INT(stat1, 4, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_WEAPS")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_WEAPS")
    STATS.STAT_SET_INT(stat0, 1, true)
    STATS.STAT_SET_INT(stat1, 1, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_VEHS")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_VEHS")
    STATS.STAT_SET_INT(stat0, 3, true)
    STATS.STAT_SET_INT(stat1, 3, true)

    stat0 = MISC.GET_HASH_KEY("MP0_CAS_HEIST_FLOW")
    stat1 = MISC.GET_HASH_KEY("MP1_CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(stat0, -1, true)
    STATS.STAT_SET_INT(stat1, -1, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3_LAST_APPROACH")
    stat1 = MISC.GET_HASH_KEY("MP1_H3_LAST_APPROACH")
    STATS.STAT_SET_INT(stat0, 0, true)
    STATS.STAT_SET_INT(stat1, 0, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_APPROACH")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_APPROACH")
    STATS.STAT_SET_INT(stat0, 1, true)
    STATS.STAT_SET_INT(stat1, 1, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3_HARD_APPROACH")
    stat1 = MISC.GET_HASH_KEY("MP1_H3_HARD_APPROACH")
    STATS.STAT_SET_INT(stat0, 1, true)
    STATS.STAT_SET_INT(stat1, 1, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_TARGET")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_TARGET")
    STATS.STAT_SET_INT(stat0, 3, true)
    STATS.STAT_SET_INT(stat1, 3, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_POI")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_POI")
    STATS.STAT_SET_INT(stat0, 1023, true)
    STATS.STAT_SET_INT(stat1, 1023, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_ACCESSPOINTS")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_ACCESSPOINTS")
    STATS.STAT_SET_INT(stat0, 2047, true)
    STATS.STAT_SET_INT(stat1, 2047, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_CREWWEAP")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_CREWWEAP")
    STATS.STAT_SET_INT(stat0, 4, true)
    STATS.STAT_SET_INT(stat1, 4, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_CREWDRIVER")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_CREWDRIVER")
    STATS.STAT_SET_INT(stat0, 3, true)
    STATS.STAT_SET_INT(stat1, 3, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_CREWHACKER")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_CREWHACKER")
    STATS.STAT_SET_INT(stat0, 4, true)
    STATS.STAT_SET_INT(stat1, 4, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_DISRUPTSHIP")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_DISRUPTSHIP")
    STATS.STAT_SET_INT(stat0, 3, true)
    STATS.STAT_SET_INT(stat1, 3, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_BODYARMORLVL")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_BODYARMORLVL")
    STATS.STAT_SET_INT(stat0, -1, true)
    STATS.STAT_SET_INT(stat1, -1, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_KEYLEVELS")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_KEYLEVELS")
    STATS.STAT_SET_INT(stat0, 2, true)
    STATS.STAT_SET_INT(stat1, 2, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_BITSET1")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_BITSET1")
    STATS.STAT_SET_INT(stat0, 127, true)
    STATS.STAT_SET_INT(stat1, 127, true)

    stat0 = MISC.GET_HASH_KEY("MP0_H3OPT_BITSET0")
    stat1 = MISC.GET_HASH_KEY("MP1_H3OPT_BITSET0")
    STATS.STAT_SET_INT(stat0, 262270, true)
    STATS.STAT_SET_INT(stat1, 262270, true)

    -- Reset the board 
    local chf0 = MISC.GET_HASH_KEY("MP0_CAS_HEIST_FLOW")
    local chf1 = MISC.GET_HASH_KEY("MP1_CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(chf0, -1, true)
    STATS.STAT_SET_INT(chf1, -1, true)

    -- Save & refresh board
    STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    script.sleep(100)
    locals.set_int("gb_casino_heist_planning", 210, 2)
    notification.show("隐秘潜入已生效!")
end)

menu.add_action(presetsMenu, "兵不厌诈", function()

    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    -- H3OPT_MASKS
    local H3OPT_MASKS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_MASKS")
    local H3OPT_MASKS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_MASKS")
    STATS.STAT_SET_INT(H3OPT_MASKS0, 2, true)
    STATS.STAT_SET_INT(H3OPT_MASKS1, 2, true)

    -- H3OPT_WEAPS
    local H3OPT_WEAPS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_WEAPS")
    local H3OPT_WEAPS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_WEAPS")
    STATS.STAT_SET_INT(H3OPT_WEAPS0, 1, true)
    STATS.STAT_SET_INT(H3OPT_WEAPS1, 1, true)

    -- H3OPT_VEHS
    local H3OPT_VEHS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_VEHS")
    local H3OPT_VEHS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_VEHS")
    STATS.STAT_SET_INT(H3OPT_VEHS0, 3, true)
    STATS.STAT_SET_INT(H3OPT_VEHS1, 3, true)

    -- CAS_HEIST_FLOW
    local CAS_HEIST_FLOW0 = MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_FLOW")
    local CAS_HEIST_FLOW1 = MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(CAS_HEIST_FLOW0, -1, true)
    STATS.STAT_SET_INT(CAS_HEIST_FLOW1, -1, true)

    -- H3_LAST_APPROACH
    local H3_LAST_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3_LAST_APPROACH")
    local H3_LAST_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3_LAST_APPROACH")
    STATS.STAT_SET_INT(H3_LAST_APPROACH0, 0, true)
    STATS.STAT_SET_INT(H3_LAST_APPROACH1, 0, true)

    -- H3OPT_APPROACH
    local H3OPT_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_APPROACH")
    local H3OPT_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_APPROACH")
    STATS.STAT_SET_INT(H3OPT_APPROACH0, 2, true)
    STATS.STAT_SET_INT(H3OPT_APPROACH1, 2, true)

    -- H3_HARD_APPROACH
    local H3_HARD_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3_HARD_APPROACH")
    local H3_HARD_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3_HARD_APPROACH")
    STATS.STAT_SET_INT(H3_HARD_APPROACH0, 2, true)
    STATS.STAT_SET_INT(H3_HARD_APPROACH1, 2, true)

    -- H3OPT_TARGET
    local H3OPT_TARGET0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_TARGET")
    local H3OPT_TARGET1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_TARGET")
    STATS.STAT_SET_INT(H3OPT_TARGET0, 3, true)
    STATS.STAT_SET_INT(H3OPT_TARGET1, 3, true)

    -- H3OPT_POI
    local H3OPT_POI0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_POI")
    local H3OPT_POI1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_POI")
    STATS.STAT_SET_INT(H3OPT_POI0, 1023, true)
    STATS.STAT_SET_INT(H3OPT_POI1, 1023, true)

    -- H3OPT_ACCESSPOINTS
    local H3OPT_ACCESSPOINTS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_ACCESSPOINTS")
    local H3OPT_ACCESSPOINTS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_ACCESSPOINTS")
    STATS.STAT_SET_INT(H3OPT_ACCESSPOINTS0, 2047, true)
    STATS.STAT_SET_INT(H3OPT_ACCESSPOINTS1, 2047, true)

    -- H3OPT_CREWWEAP
    local H3OPT_CREWWEAP0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWWEAP")
    local H3OPT_CREWWEAP1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWWEAP")
    STATS.STAT_SET_INT(H3OPT_CREWWEAP0, 4, true)
    STATS.STAT_SET_INT(H3OPT_CREWWEAP1, 4, true)

    -- H3OPT_CREWDRIVER
    local H3OPT_CREWDRIVER0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWDRIVER")
    local H3OPT_CREWDRIVER1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWDRIVER")
    STATS.STAT_SET_INT(H3OPT_CREWDRIVER0, 3, true)
    STATS.STAT_SET_INT(H3OPT_CREWDRIVER1, 3, true)

    -- H3OPT_CREWHACKER
    local H3OPT_CREWHACKER0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWHACKER")
    local H3OPT_CREWHACKER1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWHACKER")
    STATS.STAT_SET_INT(H3OPT_CREWHACKER0, 4, true)
    STATS.STAT_SET_INT(H3OPT_CREWHACKER1, 4, true)

    -- H3OPT_DISRUPTSHIP
    local H3OPT_DISRUPTSHIP0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_DISRUPTSHIP")
    local H3OPT_DISRUPTSHIP1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_DISRUPTSHIP")
    STATS.STAT_SET_INT(H3OPT_DISRUPTSHIP0, 3, true)
    STATS.STAT_SET_INT(H3OPT_DISRUPTSHIP1, 3, true)

    -- H3OPT_BODYARMORLVL
    local H3OPT_BODYARMORLVL0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BODYARMORLVL")
    local H3OPT_BODYARMORLVL1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BODYARMORLVL")
    STATS.STAT_SET_INT(H3OPT_BODYARMORLVL0, -1, true)
    STATS.STAT_SET_INT(H3OPT_BODYARMORLVL1, -1, true)

    -- H3OPT_KEYLEVELS
    local H3OPT_KEYLEVELS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_KEYLEVELS")
    local H3OPT_KEYLEVELS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_KEYLEVELS")
    STATS.STAT_SET_INT(H3OPT_KEYLEVELS0, 2, true)
    STATS.STAT_SET_INT(H3OPT_KEYLEVELS1, 2, true)

    -- H3OPT_BITSET1
    local H3OPT_BITSET10 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET1")
    local H3OPT_BITSET11 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET1")
    STATS.STAT_SET_INT(H3OPT_BITSET10, 159, true)
    STATS.STAT_SET_INT(H3OPT_BITSET11, 159, true)

    -- H3OPT_BITSET0
    local H3OPT_BITSET00 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET0")
    local H3OPT_BITSET01 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET0")
    STATS.STAT_SET_INT(H3OPT_BITSET00, 524118, true)
    STATS.STAT_SET_INT(H3OPT_BITSET01, 524118, true)

    -- Reset the board
    local CAS_HEIST_FLOW0 = MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_FLOW")
    local CAS_HEIST_FLOW1 = MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(CAS_HEIST_FLOW0, -1, true)
    STATS.STAT_SET_INT(CAS_HEIST_FLOW1, -1, true)

    -- Save & refresh board
    STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    script.sleep(100)
    locals.set_int("gb_casino_heist_planning", 210, 2)
    notification.show("兵不厌诈已生效!")
end)

-- Add Aggressive approach 
menu.add_action(presetsMenu, "暴力强攻", function()

    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    -- H3OPT_MASKS
    local H3OPT_MASKS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_MASKS")
    local H3OPT_MASKS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_MASKS")
    STATS.STAT_SET_INT(H3OPT_MASKS0, 4, true)
    STATS.STAT_SET_INT(H3OPT_MASKS1, 4, true)

    -- H3OPT_WEAPS
    local H3OPT_WEAPS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_WEAPS")
    local H3OPT_WEAPS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_WEAPS")
    STATS.STAT_SET_INT(H3OPT_WEAPS0, 1, true)
    STATS.STAT_SET_INT(H3OPT_WEAPS1, 1, true)

    -- H3OPT_VEHS
    local H3OPT_VEHS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_VEHS")
    local H3OPT_VEHS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_VEHS")
    STATS.STAT_SET_INT(H3OPT_VEHS0, 3, true)
    STATS.STAT_SET_INT(H3OPT_VEHS1, 3, true)

    -- CAS_HEIST_FLOW
    local CAS_HEIST_FLOW0 = MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_FLOW")
    local CAS_HEIST_FLOW1 = MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(CAS_HEIST_FLOW0, -1, true)
    STATS.STAT_SET_INT(CAS_HEIST_FLOW1, -1, true)

    -- H3_LAST_APPROACH
    local H3_LAST_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3_LAST_APPROACH")
    local H3_LAST_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3_LAST_APPROACH")
    STATS.STAT_SET_INT(H3_LAST_APPROACH0, 0, true)
    STATS.STAT_SET_INT(H3_LAST_APPROACH1, 0, true)

    -- H3OPT_APPROACH
    local H3OPT_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_APPROACH")
    local H3OPT_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_APPROACH")
    STATS.STAT_SET_INT(H3OPT_APPROACH0, 3, true)
    STATS.STAT_SET_INT(H3OPT_APPROACH1, 3, true)

    -- H3_HARD_APPROACH
    local H3_HARD_APPROACH0 = MISC.GET_HASH_KEY(prefix0 .. "H3_HARD_APPROACH")
    local H3_HARD_APPROACH1 = MISC.GET_HASH_KEY(prefix1 .. "H3_HARD_APPROACH")
    STATS.STAT_SET_INT(H3_HARD_APPROACH0, 3, true)
    STATS.STAT_SET_INT(H3_HARD_APPROACH1, 3, true)

    -- H3OPT_TARGET
    local H3OPT_TARGET0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_TARGET")
    local H3OPT_TARGET1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_TARGET")
    STATS.STAT_SET_INT(H3OPT_TARGET0, 3, true)
    STATS.STAT_SET_INT(H3OPT_TARGET1, 3, true)

    -- H3OPT_POI
    local H3OPT_POI0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_POI")
    local H3OPT_POI1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_POI")
    STATS.STAT_SET_INT(H3OPT_POI0, 1023, true)
    STATS.STAT_SET_INT(H3OPT_POI1, 1023, true)

    -- H3OPT_ACCESSPOINTS
    local H3OPT_ACCESSPOINTS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_ACCESSPOINTS")
    local H3OPT_ACCESSPOINTS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_ACCESSPOINTS")
    STATS.STAT_SET_INT(H3OPT_ACCESSPOINTS0, 2047, true)
    STATS.STAT_SET_INT(H3OPT_ACCESSPOINTS1, 2047, true)

    -- H3OPT_CREWWEAP
    local H3OPT_CREWWEAP0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWWEAP")
    local H3OPT_CREWWEAP1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWWEAP")
    STATS.STAT_SET_INT(H3OPT_CREWWEAP0, 4, true)
    STATS.STAT_SET_INT(H3OPT_CREWWEAP1, 4, true)

    -- H3OPT_CREWDRIVER
    local H3OPT_CREWDRIVER0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWDRIVER")
    local H3OPT_CREWDRIVER1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWDRIVER")
    STATS.STAT_SET_INT(H3OPT_CREWDRIVER0, 3, true)
    STATS.STAT_SET_INT(H3OPT_CREWDRIVER1, 3, true)

    -- H3OPT_CREWHACKER
    local H3OPT_CREWHACKER0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWHACKER")
    local H3OPT_CREWHACKER1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWHACKER")
    STATS.STAT_SET_INT(H3OPT_CREWHACKER0, 4, true)
    STATS.STAT_SET_INT(H3OPT_CREWHACKER1, 4, true)

    -- H3OPT_DISRUPTSHIP
    local H3OPT_DISRUPTSHIP0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_DISRUPTSHIP")
    local H3OPT_DISRUPTSHIP1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_DISRUPTSHIP")
    STATS.STAT_SET_INT(H3OPT_DISRUPTSHIP0, 3, true)
    STATS.STAT_SET_INT(H3OPT_DISRUPTSHIP1, 3, true)

    -- H3OPT_BODYARMORLVL
    local H3OPT_BODYARMORLVL0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BODYARMORLVL")
    local H3OPT_BODYARMORLVL1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BODYARMORLVL")
    STATS.STAT_SET_INT(H3OPT_BODYARMORLVL0, -1, true)
    STATS.STAT_SET_INT(H3OPT_BODYARMORLVL1, -1, true)

    -- H3OPT_KEYLEVELS
    local H3OPT_KEYLEVELS0 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_KEYLEVELS")
    local H3OPT_KEYLEVELS1 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_KEYLEVELS")
    STATS.STAT_SET_INT(H3OPT_KEYLEVELS0, 2, true)
    STATS.STAT_SET_INT(H3OPT_KEYLEVELS1, 2, true)

    -- H3OPT_BITSET1
    local H3OPT_BITSET10 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET1")
    local H3OPT_BITSET11 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET1")
    STATS.STAT_SET_INT(H3OPT_BITSET10, 799, true)
    STATS.STAT_SET_INT(H3OPT_BITSET11, 799, true)

    -- H3OPT_BITSET0
    local H3OPT_BITSET00 = MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET0")
    local H3OPT_BITSET01 = MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET0")
    STATS.STAT_SET_INT(H3OPT_BITSET00, 3670102, true)
    STATS.STAT_SET_INT(H3OPT_BITSET01, 3670102, true) 

    -- Reset the board
    local CAS_HEIST_FLOW0 = MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_FLOW")
    local CAS_HEIST_FLOW1 = MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_FLOW")
    STATS.STAT_SET_INT(CAS_HEIST_FLOW0, -1, true)
    STATS.STAT_SET_INT(CAS_HEIST_FLOW1, -1, true)

    -- Save & refresh board
    STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    script.sleep(100)
    locals.set_int("gb_casino_heist_planning", 210, 2)
    notification.show(("暴力强攻已生效!"))
end)

menu.add_action(presetsMenu, "重置抢劫准备 ", function()
    -- reset preps casino

    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    -- H3OPT_DISRUPTSHIP
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_DISRUPTSHIP"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_DISRUPTSHIP"), 0, true)

    -- H3OPT_BODYARMORLVL
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BODYARMORLVL"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BODYARMORLVL"), 0, true)

    -- H3OPT_CREWWEAP
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWWEAP"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWWEAP"), 0, true)

    -- H3OPT_CREWDRIVER
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWDRIVER"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWDRIVER"), 0, true)

    -- H3OPT_CREWHACKER
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_CREWHACKER"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_CREWHACKER"), 0, true)

    -- H3OPT_KEYLEVELS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_KEYLEVELS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_KEYLEVELS"), 0, true)

    -- H3OPT_MODVEH
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_MODVEH"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_MODVEH"), 0, true)

    -- H3OPT_MASKS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_MASKS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_MASKS"), 0, true)

    -- H3OPT_WEAPS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_WEAPS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_WEAPS"), 0, true)

    -- H3OPT_VEHS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_VEHS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_VEHS"), 0, true)

    -- H3OPT_APPROACH
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_APPROACH"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_APPROACH"), 0, true)

    -- H3OPT_BITSET0
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET0"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET0"), 0, true)

    -- H3OPT_ACCESSPOINTS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_ACCESSPOINTS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_ACCESSPOINTS"), 0, true)

    -- H3OPT_TARGET
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_TARGET"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_TARGET"), 0, true)

    -- H3OPT_POI
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_POI"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_POI"), 0, true)

    -- H3OPT_BITSET1
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_BITSET1"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_BITSET1"), 0, true)

    -- H3_PARTIALPASS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_PARTIALPASS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_PARTIALPASS"), 0, true)

    -- CAS_HEIST_NOTS
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_NOTS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_NOTS"), 0, true)

    -- CAS_HEIST_FLOW (set to -1)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "CAS_HEIST_FLOW"), -1, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "CAS_HEIST_FLOW"), -1, true)

    -- H3_LAST_APPROACH
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_LAST_APPROACH"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_LAST_APPROACH"), 0, true)

    -- H3_HARD_APPROACH
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_HARD_APPROACH"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_HARD_APPROACH"), 0, true)

    -- H3_SKIPCOUNT
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_SKIPCOUNT"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_SKIPCOUNT"), 0, true)

    -- H3_MISSIONSKIPPED
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_MISSIONSKIPPED"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_MISSIONSKIPPED"), 0, true)

    -- H3_BOARD_DIALOGUE0
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_BOARD_DIALOGUE0"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_BOARD_DIALOGUE0"), 0, true)

    -- H3_BOARD_DIALOGUE1
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_BOARD_DIALOGUE1"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_BOARD_DIALOGUE1"), 0, true)

    -- H3_BOARD_DIALOGUE2
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_BOARD_DIALOGUE2"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_BOARD_DIALOGUE2"), 0, true)

    -- H3_VEHICLESUSED
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_VEHICLESUSED"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_VEHICLESUSED"), 0, true)

    -- MPPLY_H3_COOLDOWN
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "MPPLY_H3_COOLDOWN"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "MPPLY_H3_COOLDOWN"), 0, true)

    -- H3_COMPLETEDPOSIX
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3_COMPLETEDPOSIX"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3_COMPLETEDPOSIX"), 0, true)

    -- Save & refresh board
    STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    script.sleep(100)
    locals.set_int("gb_casino_heist_planning", 210, 2)
    notification.show("抢劫准备工作已重置!")
end)

-- holds value for cuts
local hostCut = 120
local p2Cut = 120
local p3Cut = 120
local p4Cut = 120

-- Sliders for cuts
menu.add_int(cutsMenu, "玩家分红1 % ", 120, 0, 1000, 1, function(val)
    hostCut = val
end)

menu.add_int(cutsMenu, "玩家分红2 % ", 120, 0, 1000, 1, function(val)
    p2Cut = val
end)

menu.add_int(cutsMenu, "玩家分红3 % ", 120, 0, 1000, 1, function(val)
    p3Cut = val
end)

menu.add_int(cutsMenu, "玩家分红4 % ", 120, 0, 1000, 1, function(val)
    p4Cut = val
end)

-- Set Cuts casino 
menu.add_action(cutsMenu, "应用分红", function()
    globals.set_int(1968996 + 1497 + 736 + 92 + 1, hostCut)
    globals.set_int(1968996 + 1497 + 736 + 92 + 2, p2Cut)
    globals.set_int(1968996 + 1497 + 736 + 92 + 3, p3Cut)
    globals.set_int(1968996 + 1497 + 736 + 92 + 4, p4Cut)
    notification.show("已应用分红")
end)
-- force ready players casino
menu.add_action(cutsMenu, "强制所有玩家准备", function()
	network.force_script_host("fm_mission_controller")
    script.yield(1000)
    globals.set_int(1973359 + 1 + (0 * 68) + 7 + 1, 1)
    globals.set_int(1973359 + 1 + (1 * 68) + 7 + 2, 1)
    globals.set_int(1973359 + 1 + (2 * 68) + 7 + 3, 1)
    globals.set_int(1973359 + 1 + (3 * 68) + 7 + 4, 1)
	notification.show("已强制所有玩家准备")
end)
--skips cutscene using native
menu.add_action(toolsMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)

-- Fingerprint Hack button casino
menu.add_action(toolsMenu, "绕过指纹破解", function()
    locals.set_int("fm_mission_controller", 54037, 5)
    notification.show("Bypass Fingerprint Hack enabled")
end)

-- Keypad Hack button casino
menu.add_action(toolsMenu, "绕过键盘输入破解", function()
    locals.set_int("fm_mission_controller", 55103, 5)
    notification.show("Bypass Keypad Hack enabled")
end)
--vault drill bypass casino
menu.add_action(toolsMenu, "赌场金库大门秒钻孔", function()
    local drillValue = locals.get_int("fm_mission_controller", 10549 + 37)
    locals.set_int("fm_mission_controller", 10549 + 7, drillValue)
    notification.show("Vault drill bypassed")
end)

-- Cooldown remover (casino)
menu.add_action(toolsMenu, "移除赌场抢劫冷却时间", function()
	notification.show("Removed Cooldown. Make Sure You Exit Your Arcade To Use This Feature")
local prefix0 = "MP0_"
local prefix1 = "MP1_"

    local completedPosix0 = MISC.GET_HASH_KEY(prefix0 .. "H3_COMPLETEDPOSIX")
    local completedPosix1 = MISC.GET_HASH_KEY(prefix1 .. "H3_COMPLETEDPOSIX")
    STATS.STAT_SET_INT(completedPosix0, -1, true)
    STATS.STAT_SET_INT(completedPosix1, -1, true)

    local cooldown0 = MISC.GET_HASH_KEY(prefix0 .. "MPPLY_H3_COOLDOWN")
    local cooldown1 = MISC.GET_HASH_KEY(prefix1 .. "MPPLY_H3_COOLDOWN")
    STATS.STAT_SET_INT(cooldown0, -1, true)
    STATS.STAT_SET_INT(cooldown1, -1, true)
end)

-- Skip Checkpoint uses 2 different scripts might need to force script host for multiplayer, might add a multiplayer button or smth
menu.add_action(toolsMenu, "跳过检查点", function()
    local offset = 20391 + 2
	local offset1 = 54763 + 2
    local bitToSet = (1 << 17)
	

    local currentVal = locals.get_int("fm_mission_controller", offset)
    locals.set_int("fm_mission_controller", offset, currentVal | bitToSet)
	local currentVal = locals.get_int("fm_mission_controller_2020", offset)
    locals.set_int("fm_mission_controller_2020", offset1, currentVal | bitToSet)

    notification.show("正在跳过检查点...")
end)


-- Cloud Save (jinx)
menu.add_action(heistToolMenu, "云保存", function()
    notification.show("Saving...")
    local ok, success = pcall(function() -- lmao dont ask
        return STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)
    end)
    if not ok then
        notification.show("云保存错误: " .. tostring(success))
    elseif success then
        notification.show("云保存成功!")
    else
        notification.show("云保存失败.")
    end
end)

-- instant finish casino 
menu.add_action(toolsMenu, "立刻完成赌场抢劫", function()
    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    network.force_script_host("fm_mission_controller")
    script.yield(1000)

    -- based on approach selected cuz agressive is a pain in the bum
    if	STATS.STAT_GET_INT(MISC.GET_HASH_KEY(prefix0 .. "H3OPT_APPROACH") == 3)
	or 
        STATS.STAT_GET_INT(MISC.GET_HASH_KEY(prefix1 .. "H3OPT_APPROACH") == 3)
	then
        -- Agressive
        locals.set_int("fm_mission_controller", 20391, 12)
        locals.set_int("fm_mission_controller", 22132, 80)
        locals.set_int("fm_mission_controller", 23077, 10000000)
        locals.set_int("fm_mission_controller", 29012, 99999)
        locals.set_int("fm_mission_controller", 32536, 99999)
		notification.show("立刻完成抢劫")

    else --Big con and Silent
        locals.set_int("fm_mission_controller", 21453, 5)          
        locals.set_int("fm_mission_controller", 22132, 80)         
        locals.set_int("fm_mission_controller", 23077, 10000000)   
        locals.set_int("fm_mission_controller", 29012, 99999)      
        locals.set_int("fm_mission_controller", 32536, 99999)      
		notification.show("立刻完成抢劫")
    end
end)

menu.add_action(doomsHeistMenu, "预设最高分红 2,550,000$")
-- Act I: The Data Breaches
menu.add_action(doomspresetMenu, " 一键开启数据泄露差事 ", function()
    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_MISSION_PROG"), 503, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_MISSION_PROG"), 503, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_HEIST_STATUS"), -229383, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_HEIST_STATUS"), -229383, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)


    locals.set_int("gb_gang_ops_planning", 209, 6)
	STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)

    notification.show("已启用数据泄露差事")
end)

-- Act II: The Bogdan Problem
menu.add_action(doomspresetMenu, "一键开启 波格丹危机 ", function()
    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_MISSION_PROG"), 240, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_MISSION_PROG"), 240, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_HEIST_STATUS"), -229378, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_HEIST_STATUS"), -229378, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)

    locals.set_int("gb_gang_ops_planning", 209, 6)
	STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)

    notification.show("已启用波格丹危机")
end)

-- Act III: The Doomsday Scenario
menu.add_action(doomspresetMenu, "一键开启 末日将至 ", function()
    local prefix0 = "MP0_"
    local prefix1 = "MP1_"

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_MISSION_PROG"), 16368, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_MISSION_PROG"), 16368, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_HEIST_STATUS"), -229380, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_HEIST_STATUS"), -229380, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)

    locals.set_int("gb_gang_ops_planning", 209, 6)
	STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)

    notification.show("已启用末日将至")
end)

menu.add_action(doomspresetMenu, "重置末日抢劫 ", function()
    local prefix0 = "MP0_"
    local prefix1 = "MP1_"


    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_MISSION_PROG"), 503, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_MISSION_PROG"), 503, true)

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_HEIST_STATUS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_HEIST_STATUS"), 0, true)


    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix0 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix1 .. "GANGOPS_FLOW_NOTIFICATIONS"), 1557, true)

    -- Force reload of the planning screen
    locals.set_int("gb_gang_ops_planning", 209, 6)
	STATS.STAT_SAVE(globals.get_int(1574927), true, 3, 0)


    notification.show("末日抢劫已重置")
end)

menu.add_action(doomscutspresetMenu, "应用 行动 1 - 数据泄露 最大分红", function() 
    local base = 1965032
    globals.set_int(base + 1, 261)
    globals.set_int(base + 2, 261)
    globals.set_int(base + 3, 261)
    globals.set_int(base + 4, 261)
    notification.show("已应用数据泄露差事最大分红") 
end)

menu.add_action(doomscutspresetMenu, "应用 行动 2 - 波格丹危机 最大分红", function()
    local base = 1965032
    globals.set_int(base + 1, 178)
    globals.set_int(base + 2, 178)
    globals.set_int(base + 3, 178)
    globals.set_int(base + 4, 178)
    notification.show("已应用波格丹危机最大分红")
end)

menu.add_action(doomscutspresetMenu, "应用 行动 3 - 末日将至 最大分红", function()
    local base = 1965032
    globals.set_int(base + 1, 141)
    globals.set_int(base + 2, 141)
    globals.set_int(base + 3, 141)
    globals.set_int(base + 4, 141)
    notification.show("已应用末日将至差事最大分红")
end)

-- Default cuts amazing
local hostCut = 120
local p2Cut = 120
local p3Cut = 120
local p4Cut = 120

-- Sliders to edit player cuts noice
menu.add_int(doomsCutsMenu, "玩家分红1 % ", 150, 0, 1000, 5, function(val)
    hostCut = val
end)

menu.add_int(doomsCutsMenu, "玩家分红2 % ", 150, 0, 1000, 5, function(val)
    p2Cut = val
end)

menu.add_int(doomsCutsMenu, "玩家分红3 % ", 150, 0, 1000, 5, function(val)
    p3Cut = val
end)

menu.add_int(doomsCutsMenu, "玩家分红4 % ", 150, 0, 1000, 5, function(val)
    p4Cut = val
end)

-- Apply all cuts
menu.add_action(doomsCutsMenu, "应用分红", function()

    local base = 1965032

    globals.set_int(base + 1, hostCut) 
    globals.set_int(base + 2, p2Cut)    
    globals.set_int(base + 3, p3Cut)   
    globals.set_int(base + 4, p4Cut)    

    notification.show("已应用分红")
end)

-- Ready player global indexes hehe dont fkn ask
local Ready = {
    Player1 = { type = "int", global = 1882449 + 1 + (0 * 149) + 43 + 11 + 1 },
    Player2 = { type = "int", global = 1882449 + 1 + (1 * 149) + 43 + 11 + 2 },
    Player3 = { type = "int", global = 1882449 + 1 + (2 * 149) + 43 + 11 + 3 },
    Player4 = { type = "int", global = 1882449 + 1 + (3 * 149) + 43 + 11 + 4 },
}

menu.add_action(doomsCutsMenu, "强制所有玩家准备 ", function()
    -- Force host of script
    network.force_script_host("fm_mission_controller")
    script.yield(1000)

    -- Set all players to Ready
    globals.set_int(Ready.Player1.global, 1)
    globals.set_int(Ready.Player2.global, 1)
    globals.set_int(Ready.Player3.global, 1)
    globals.set_int(Ready.Player4.global, 1)

    notification.show("已强制准备")
end)
	
menu.add_action(doomsToolsMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)

menu.add_action(doomsToolsMenu, "秒破解数据泄露服务器面板 ", function()

    locals.set_int("fm_mission_controller", 1539, 2)


    notification.show("已秒破解数据泄露服务器面板 ")
end)

menu.add_action(doomsToolsMenu, " 秒破解末日将至激光拼图面板 ", function()

    locals.set_int("fm_mission_controller", 1431, 3) 


    notification.show("已秒破解末日将至激光拼图面板")
end)


menu.add_action(doomsToolsMenu, "跳过检查点 ", function()
    local offset = 20391 + 2
	local offset1 = 54763 + 2
    local bitToSet = (1 << 17)

	network.force_script_host("fm_mission_controller")
	script.yield(1000)
	

    local currentVal = locals.get_int("fm_mission_controller", offset)
    locals.set_int("fm_mission_controller", offset, currentVal | bitToSet)
	local currentVal = locals.get_int("fm_mission_controller_2020", offset)
    locals.set_int("fm_mission_controller_2020", offset1, currentVal | bitToSet)

    notification.show("正在跳过检查点...")
end)


-- Instant finish Doomsday
menu.add_action(doomsToolsMenu, "立刻完成末日抢劫", function()
    network.force_script_host("fm_mission_controller")
    script.yield(1000)


    locals.set_int("fm_mission_controller", 20391 + 1062, 5)

    locals.set_int("fm_mission_controller", 20391 + 1232 + 1, 999999)

    function set_bits(value, positions)
        for _, position in ipairs(positions) do
            value = value | (1 << position)
        end
        return value
    end

    local current_value = locals.get_int("fm_mission_controller", 20391 + 1)
    local new_value = set_bits(current_value, { 9, 16 })
    locals.set_int("fm_mission_controller", 20391 + 1, new_value)
end)

menu.add_action(classicHeistMenu, "预设最高分红 3,000,000$ ")

menu.add_action(classicToolsMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)

menu.add_action(classicPrepsMenu, "跳过公寓任务抢劫前置 ", function()
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_PLANNING_STAGE"), -1, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_PLANNING_STAGE"), -1, true)
	notification.show("已跳过公寓任务抢劫前置, 切换战局以应用")
end)

menu.add_action(classicPrepsMenu, "重新加载抢劫面板 ", function()
 
    globals.set_int(1931835, 22)
	notification.show("已重新加载抢劫面板")
end)


menu.add_action(classicToolsMenu, " 秒破解全福银行贪吃蛇 ", function()

    locals.set_int("fm_mission_controller", 12244, 7)


    notification.show("已秒破解全福银行贪吃蛇")
end)

menu.add_action(classicToolsMenu, "绕过全福银行钻头钻孔 ", function()

    locals.set_float("fm_mission_controller", 10520, 100.0)


    notification.show("已绕过全福银行钻头钻孔")
end)

menu.add_action(classicToolsMenu, "绕过太平洋银行黑客破解 ", function()

    locals.set_int("fm_mission_controller", 10213, 9)


    notification.show("已绕过太平洋银行黑客破解")
end)

menu.add_action(classicToolsMenu, "取消公寓抢劫冷却时间 ", function()
    -- Calculate global for the current player's cooldown
    local playerId = PLAYER.PLAYER_ID()
    local cooldownGlobal = 1877086 + 1 + (playerId * 77) + 76


    globals.set_int(cooldownGlobal, -1)


    notification.show("已取消公寓抢劫冷却时间")
end)

menu.add_action(classicToolsMenu, "跳过检查点 ", function()
    local offset = 20391 + 2
	local offset1 = 54763 + 2
    local bitToSet = (1 << 17)
	

    local currentVal = locals.get_int("fm_mission_controller", offset)
    locals.set_int("fm_mission_controller", offset, currentVal | bitToSet)
	local currentVal = locals.get_int("fm_mission_controller_2020", offset)
    locals.set_int("fm_mission_controller_2020", offset1, currentVal | bitToSet)

    notification.show("正在跳过检查点...")
end)

menu.add_action(classicToolsMenu, "立刻完成 ", function()
    -- Force script host
    network.force_script_host("fm_mission_controller")
    script.yield(1000)

    -- Read current apartment heist type
    local playerId = PLAYER.PLAYER_ID()
    local heistTypeGlobal = 1877086 + 1 + (playerId * 77) + 24 + 1
    local heistType = globals.get_int(heistTypeGlobal)

    -- Heist type for Pacific Standard
    local PACIFIC_STANDARD = 1182286714

    if heistType == PACIFIC_STANDARD then
        -- Finish for Pacific Standard Job
        locals.set_int("fm_mission_controller", 20391 + 1062, 5)        
        locals.set_int("fm_mission_controller", 20391 + 1740 + 1, 80)   
        locals.set_int("fm_mission_controller", 20391 + 2686, 10000000)  
        locals.set_int("fm_mission_controller", 29011 + 1, 99999)        
        locals.set_int("fm_mission_controller", 32467 + 1 + 68, 99999)   
    else
        --finish for other Classic Heists
        locals.set_int("fm_mission_controller", 20391, 12)               
        locals.set_int("fm_mission_controller", 20391 + 2686, 99999)     
        locals.set_int("fm_mission_controller", 29011 + 1, 99999)        
        locals.set_int("fm_mission_controller", 32467 + 1 + 68, 99999)   
    end

    notification.show("立刻完成抢劫")
end)

menu.add_action(classicHeistMenu, "解锁公寓所有抢劫任务 ", function()
    -- Fleeca
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_0"), 914229232, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_0_L"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_0"), 914229232, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_0_L"), 5, true)

    -- Prison Break
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_1"), 648305506, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_1_L"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_1"), 648305506, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_1_L"), 5, true)

    -- Humane Labs
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_2"), 3046362882, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_2_L"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_2"), 3046362882, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_2_L"), 5, true)

    -- Series A
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_3"), 2332217394, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_3_L"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_3"), 2332217394, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_3_L"), 5, true)

    -- Pacific Standard
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_4"), 3637220192, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_HEIST_SAVED_STRAND_4_L"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_4"), 3637220192, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_HEIST_SAVED_STRAND_4_L"), 5, true)

    notification.show("已解锁所有公寓抢劫任务 -> 请重开游戏以应用.")
end)

local classicCutsHelper = menu.add_submenu(classicCutsMenu, "自动抢劫分红预设") -- Thanks to @wolfl3 for helping me on this one, Legend

local classic_cut1 = 100
local classic_cut2 = 100
local classic_cut3 = 100
local classic_cut4 = 100


local function apply_cuts()
    local base_global = 1931800
    local base_local = 1933768 + 3008

    local total_cut = classic_cut1 + classic_cut2 + classic_cut3 + classic_cut4
    local over_cap = total_cut - 100

    if over_cap > 0 then
        globals.set_int(base_global + 1 + 1, -over_cap)
    else
        globals.set_int(base_global + 1 + 1, 0)
    end

    globals.set_int(base_global + 1 + 2, classic_cut2)
    globals.set_int(base_global + 1 + 3, classic_cut3)
    globals.set_int(base_global + 1 + 4, classic_cut4)

    globals.set_int(base_local + 1, classic_cut1)
    globals.set_int(base_local + 2, classic_cut2)
    globals.set_int(base_local + 3, classic_cut3)
    globals.set_int(base_local + 4, classic_cut4)

end


menu.add_int(classicCutsMenu, "玩家1分红", 100, 0, 1000, 25, function(val)
    classic_cut1 = val
end)
menu.add_int(classicCutsMenu, "玩家2分红", 100, 0, 1000, 25, function(val)
    classic_cut2 = val
end)
menu.add_int(classicCutsMenu, "玩家3分红", 100, 0, 1000, 25, function(val)
    classic_cut3 = val
end)
menu.add_int(classicCutsMenu, "玩家4分红", 100, 0, 1000, 25, function(val)
    classic_cut4 = val
end)


menu.add_action(classicCutsMenu, "应用分红", apply_cuts)



menu.add_action(classicCutsHelper, "应用Fleeca 银行抢劫任务最大分红 ", function()
    classic_cut1 = 1490
    classic_cut2 = 1490
    classic_cut3 = 1490
    classic_cut4 = 1490

    notification.show("已应用最大分红 ")
    apply_cuts()  -- call the apply function
end)

menu.add_action(classicCutsHelper, "应用越狱差事最大分红 ", function()
    classic_cut1 = 429
    classic_cut2 = 429
    classic_cut3 = 429
    classic_cut4 = 429

    notification.show("已应用最大分红 ")
    apply_cuts()  
end)

menu.add_action(classicCutsHelper, "应用人道实验室差事最大分红 ", function()
    classic_cut1 = 317
    classic_cut2 = 317
    classic_cut3 = 317
    classic_cut4 = 317

    notification.show("已应用最大分红 ")
    apply_cuts() 
end)

menu.add_action(classicCutsHelper, "应用太平洋标准差事最大分红 ", function()
    classic_cut1 = 424
    classic_cut2 = 424
    classic_cut3 = 424
    classic_cut4 = 424

    notification.show("已应用最大分红 ")
    apply_cuts()  
end)

menu.add_action(classicCutsHelper, "应用A系列(崔佛的抢劫任务)最大分红 ", function()
    classic_cut1 = 200
    classic_cut2 = 200
    classic_cut3 = 200
    classic_cut4 = 200

    notification.show("已应用最大分红 ")
    apply_cuts()  
end)

menu.add_action(classicCutsMenu, "强制准备 ", function()

    network.force_script_host("fm_mission_controller")
    script.yield(1000)


    for i = 1, 4 do
        local base = 2658019
        local globalIndex = base + 1 + ((i - 1) * 467) + 269
        globals.set_int(globalIndex, 6)
    end

    notification.show("所有玩家已强制准备 ")

end)

--let the fuckfest commence 																							-Salvage Yard

--Salvage Yard

-- Helper to select vehicle for a given slot

local selectedVehicle1, selectedVehicle2, selectedVehicle3 = 0, 0, 0

local function selectVehicle(slot, index, name)
    if slot == 1 then
        selectedVehicle1 = index
    elseif slot == 2 then
        selectedVehicle2 = index
    elseif slot == 3 then
        selectedVehicle3 = index
    end
    notification.show(string.format("[Slot %d] Vehicle: %s", slot, name))
end



-- Slot 1 Configuration
local slot1 = menu.add_submenu(salvagePrepsMenu, "插槽 1 ")

-- Robbery Type
local robberyMenu1 = menu.add_submenu(slot1, "1号槽-抢劫 ")
local selectedRobbery1 = 0
for i, name in ipairs({"Cargo Ship", "帮派分子 ", "杜根 ", "讲台 ", "麦克托尼 "}) do
    menu.add_action(robberyMenu1, name, function()
        selectedRobbery1 = i - 1
        notification.show(string.format("[Slot 1] Robbery: %s", name))
    end)
end

-- Vehicle Type as buttons (Slot 1)

local vehicleMenu1 = menu.add_submenu(slot1, "1号槽位 - 车辆类型 ")
local selectedVehicle1 = 0

local function selectVehicle(slot, index, name)
    selectedVehicle1 = index
    notification.show(string.format("[Slot %d] Vehicle: %s", slot, name))
end

menu.add_action(vehicleMenu1, "LM87", function() selectVehicle(1, 1, "LM87") end)
menu.add_action(vehicleMenu1, "Cinquemila", function() selectVehicle(1, 2, "Cinquemila") end)
menu.add_action(vehicleMenu1, "Autarch", function() selectVehicle(1, 3, "Autarch") end)
menu.add_action(vehicleMenu1, "Tigon", function() selectVehicle(1, 4, "Tigon") end)
menu.add_action(vehicleMenu1, "Champion", function() selectVehicle(1, 5, "Champion") end)
menu.add_action(vehicleMenu1, "10F", function() selectVehicle(1, 6, "10F") end)
menu.add_action(vehicleMenu1, "SM722", function() selectVehicle(1, 7, "SM722") end)
menu.add_action(vehicleMenu1, "Omnis e-GT", function() selectVehicle(1, 8, "Omnis e-GT") end)
menu.add_action(vehicleMenu1, "Growler", function() selectVehicle(1, 9, "Growler") end)
menu.add_action(vehicleMenu1, "Deity", function() selectVehicle(1, 10, "Deity") end)
menu.add_action(vehicleMenu1, "Itali RSX", function() selectVehicle(1, 11, "Itali RSX") end)
menu.add_action(vehicleMenu1, "Coquette D10", function() selectVehicle(1, 12, "Coquette D10") end)
menu.add_action(vehicleMenu1, "Jubilee", function() selectVehicle(1, 13, "Jubilee") end)
menu.add_action(vehicleMenu1, "Astron", function() selectVehicle(1, 14, "Astron") end)
menu.add_action(vehicleMenu1, "Comet S2 Cabr.", function() selectVehicle(1, 15, "Comet S2 Cabr.") end)
menu.add_action(vehicleMenu1, "Torero", function() selectVehicle(1, 16, "Torero") end)
menu.add_action(vehicleMenu1, "Cheetah Classic", function() selectVehicle(1, 17, "Cheetah Classic") end)
menu.add_action(vehicleMenu1, "Turismo Classic", function() selectVehicle(1, 18, "Turismo Classic") end)
menu.add_action(vehicleMenu1, "Infernus Classic", function() selectVehicle(1, 19, "Infernus Classic") end)
menu.add_action(vehicleMenu1, "Stafford", function() selectVehicle(1, 20, "Stafford") end)
menu.add_action(vehicleMenu1, "GT500", function() selectVehicle(1, 21, "GT500") end)
menu.add_action(vehicleMenu1, "Viseris", function() selectVehicle(1, 22, "Viseris") end)
menu.add_action(vehicleMenu1, "Mamba", function() selectVehicle(1, 23, "Mamba") end)
menu.add_action(vehicleMenu1, "Coquette Black.", function() selectVehicle(1, 24, "Coquette Black.") end)
menu.add_action(vehicleMenu1, "Stinger GT", function() selectVehicle(1, 25, "Stinger GT") end)
menu.add_action(vehicleMenu1, "Z-Type", function() selectVehicle(1, 26, "Z-Type") end)
menu.add_action(vehicleMenu1, "Broadway", function() selectVehicle(1, 27, "Broadway") end)
menu.add_action(vehicleMenu1, "Vigero ZX", function() selectVehicle(1, 28, "Vigero ZX") end)
menu.add_action(vehicleMenu1, "Buffalo STX", function() selectVehicle(1, 29, "Buffalo STX") end)
menu.add_action(vehicleMenu1, "Ruston", function() selectVehicle(1, 30, "Ruston") end)
menu.add_action(vehicleMenu1, "Gauntl. Hellfire", function() selectVehicle(1, 31, "Gauntl. Hellfire") end)
menu.add_action(vehicleMenu1, "Dominator GTT", function() selectVehicle(1, 32, "Dominator GTT") end)
menu.add_action(vehicleMenu1, "Roosevelt Valor", function() selectVehicle(1, 33, "Roosevelt Valor") end)
menu.add_action(vehicleMenu1, "Swinger", function() selectVehicle(1, 34, "Swinger") end)
menu.add_action(vehicleMenu1, "Stirling GT", function() selectVehicle(1, 35, "Stirling GT") end)
menu.add_action(vehicleMenu1, "Omnis", function() selectVehicle(1, 36, "Omnis") end)
menu.add_action(vehicleMenu1, "Tropos Rallye", function() selectVehicle(1, 37, "Tropos Rallye") end)
menu.add_action(vehicleMenu1, "Jugular", function() selectVehicle(1, 38, "Jugular") end)
menu.add_action(vehicleMenu1, "Patriot Mil-Spec", function() selectVehicle(1, 39, "Patriot Mil-Spec") end)
menu.add_action(vehicleMenu1, "Toros", function() selectVehicle(1, 40, "Toros") end)
menu.add_action(vehicleMenu1, "Caracara 4x4", function() selectVehicle(1, 41, "Caracara 4x4") end)
menu.add_action(vehicleMenu1, "Sentinel Classic", function() selectVehicle(1, 42, "Sentinel Classic") end)
menu.add_action(vehicleMenu1, "Weevil", function() selectVehicle(1, 43, "Weevil") end)
menu.add_action(vehicleMenu1, "Blista Kanjo", function() selectVehicle(1, 44, "Blista Kanjo") end)
menu.add_action(vehicleMenu1, "Eudora", function() selectVehicle(1, 45, "Eudora") end)
menu.add_action(vehicleMenu1, "Kamacho", function() selectVehicle(1, 46, "Kamacho") end)
menu.add_action(vehicleMenu1, "Hellion", function() selectVehicle(1, 47, "Hellion") end)
menu.add_action(vehicleMenu1, "Ellie", function() selectVehicle(1, 48, "Ellie") end)
menu.add_action(vehicleMenu1, "Hermes", function() selectVehicle(1, 49, "Hermes") end)
menu.add_action(vehicleMenu1, "Hustler", function() selectVehicle(1, 50, "Hustler") end)
menu.add_action(vehicleMenu1, "Turismo Om.", function() selectVehicle(1, 51, "Turismo Om.") end)
menu.add_action(vehicleMenu1, "Buffalo EVX", function() selectVehicle(1, 52, "Buffalo EVX") end)
menu.add_action(vehicleMenu1, "Itali GTO St.", function() selectVehicle(1, 53, "Itali GTO St.") end)
menu.add_action(vehicleMenu1, "Virtue", function() selectVehicle(1, 54, "Virtue") end)
menu.add_action(vehicleMenu1, "Ignus", function() selectVehicle(1, 55, "Ignus") end)
menu.add_action(vehicleMenu1, "Zentorno", function() selectVehicle(1, 56, "Zentorno") end)
menu.add_action(vehicleMenu1, "Neon", function() selectVehicle(1, 57, "Neon") end)
menu.add_action(vehicleMenu1, "Furia", function() selectVehicle(1, 58, "Furia") end)
menu.add_action(vehicleMenu1, "Zorrusso", function() selectVehicle(1, 59, "Zorrusso") end)
menu.add_action(vehicleMenu1, "Thrax", function() selectVehicle(1, 60, "Thrax") end)
menu.add_action(vehicleMenu1, "Vagner", function() selectVehicle(1, 61, "Vagner") end)
menu.add_action(vehicleMenu1, "Panthere", function() selectVehicle(1, 62, "Panthere") end)
menu.add_action(vehicleMenu1, "Itali GTO", function() selectVehicle(1, 63, "Itali GTO") end)
menu.add_action(vehicleMenu1, "S80RR", function() selectVehicle(1, 64, "S80RR") end)
menu.add_action(vehicleMenu1, "Tyrant", function() selectVehicle(1, 65, "Tyrant") end)
menu.add_action(vehicleMenu1, "Entity MT", function() selectVehicle(1, 66, "Entity MT") end)
menu.add_action(vehicleMenu1, "Torero XO", function() selectVehicle(1, 67, "Torero XO") end)
menu.add_action(vehicleMenu1, "Neo", function() selectVehicle(1, 68, "Neo") end)
menu.add_action(vehicleMenu1, "Corsita", function() selectVehicle(1, 69, "Corsita") end)
menu.add_action(vehicleMenu1, "Paragon R", function() selectVehicle(1, 70, "Paragon R") end)
menu.add_action(vehicleMenu1, "Franken Stange", function() selectVehicle(1, 71, "Franken Stange") end)
menu.add_action(vehicleMenu1, "Comet Safari", function() selectVehicle(1, 72, "Comet Safari") end)
menu.add_action(vehicleMenu1, "FR36", function() selectVehicle(1, 73, "FR36") end)
menu.add_action(vehicleMenu1, "Hotring Everon", function() selectVehicle(1, 74, "Hotring Everon") end)
menu.add_action(vehicleMenu1, "Komoda", function() selectVehicle(1, 75, "Komoda") end)
menu.add_action(vehicleMenu1, "Tailgater S", function() selectVehicle(1, 76, "Tailgater S") end)
menu.add_action(vehicleMenu1, "Jester Classic", function() selectVehicle(1, 77, "Jester Classic") end)
menu.add_action(vehicleMenu1, "Jester RR", function() selectVehicle(1, 78, "Jester RR") end)
menu.add_action(vehicleMenu1, "Euros", function() selectVehicle(1, 79, "Euros") end)
menu.add_action(vehicleMenu1, "ZR350", function() selectVehicle(1, 80, "ZR350") end)
menu.add_action(vehicleMenu1, "Cypher", function() selectVehicle(1, 81, "Cypher") end)
menu.add_action(vehicleMenu1, "Dominator ASP", function() selectVehicle(1, 82, "Dominator ASP") end)
menu.add_action(vehicleMenu1, "Baller ST-D", function() selectVehicle(1, 83, "Baller ST-D") end)
menu.add_action(vehicleMenu1, "Casco", function() selectVehicle(1, 84, "Casco") end)
menu.add_action(vehicleMenu1, "Drift Yosemite", function() selectVehicle(1, 85, "Drift Yosemite") end)
menu.add_action(vehicleMenu1, "Everon", function() selectVehicle(1, 86, "Everon") end)
menu.add_action(vehicleMenu1, "Penumbra FF", function() selectVehicle(1, 87, "Penumbra FF") end)
menu.add_action(vehicleMenu1, "V-STR", function() selectVehicle(1, 88, "V-STR") end)
menu.add_action(vehicleMenu1, "Dominator GT", function() selectVehicle(1, 89, "Dominator GT") end)
menu.add_action(vehicleMenu1, "Schlagen GT", function() selectVehicle(1, 90, "Schlagen GT") end)
menu.add_action(vehicleMenu1, "Cavalcade XL", function() selectVehicle(1, 91, "Cavalcade XL") end)
menu.add_action(vehicleMenu1, "Clique", function() selectVehicle(1, 92, "Clique") end)
menu.add_action(vehicleMenu1, "Boor", function() selectVehicle(1, 93, "Boor") end)
menu.add_action(vehicleMenu1, "Sugoi", function() selectVehicle(1, 94, "Sugoi") end)
menu.add_action(vehicleMenu1, "Greenwood", function() selectVehicle(1, 95, "Greenwood") end)
menu.add_action(vehicleMenu1, "Brigham", function() selectVehicle(1, 96, "Brigham") end)
menu.add_action(vehicleMenu1, "Issi Rally", function() selectVehicle(1, 97, "Issi Rally") end)
menu.add_action(vehicleMenu1, "Seminole Fr.", function() selectVehicle(1, 98, "Seminole Fr.") end)
menu.add_action(vehicleMenu1, "Kanjo SJ", function() selectVehicle(1, 99, "Kanjo SJ") end)
menu.add_action(vehicleMenu1, "Previon", function() selectVehicle(1, 100, "Previon") end)

-- Modification
local modificationMenu1 = menu.add_submenu(slot1, "插槽 1 - 修改 ")
local selectedModification1 = 0
for i = 1, 5 do
    menu.add_action(modificationMenu1, string.format("Version %d", i), function()
        selectedModification1 = i - 1
        notification.show(string.format("[Slot 1] Modification: Version %d", i))
    end)
end

-- Claim Car
local keepMenu1 = menu.add_submenu(slot1, "插槽 1 - 领取汽车 ")
local canKeep1 = 0
menu.add_action(keepMenu1, "设为可认领 ", function()
    canKeep1 = 1
    notification.show("[Slot 1] Car is now claimable")
end)
menu.add_action(keepMenu1, "设为不可认领 ", function()
    canKeep1 = 0
    notification.show("[Slot 1] Car is now unclaimable")
end)

-- Apply Button (Slot 1)
menu.add_action(slot1, "插槽 1 - 应用更改 ", function()
    -- Updated globals
    globals.set_int(262145 + 33524 + 1, selectedRobbery1)                             
    globals.set_int(262145 + 33532 + 1, selectedVehicle1 + selectedModification1 * 100) 
    globals.set_bool(262145 + 33528 + 1, canKeep1)                                    

    -- Updated local
    locals.set_int("vehrob_planning", 535, 2)

    notification.show("插槽 1 - 应用已更改")
end)




-- Slot 2
local slot2 = menu.add_submenu(salvagePrepsMenu, "插槽 2 ")

-- Robbery Type (Slot 2)
local robberyMenu2 = menu.add_submenu(slot2, "2号槽-抢劫类型 ")
local selectedRobbery2 = 0
for i, name in ipairs({"Cargo Ship", "设为不可认领", "Duggan", "Podium", "McTony"}) do
    menu.add_action(robberyMenu2, name, function()
        selectedRobbery2 = i - 1
        notification.show(string.format("2号槽-抢劫类型: %s", name))
    end)
end

-- Vehicle Type (Slot 2)
local vehicleMenu2 = menu.add_submenu(slot2, "2号槽位 - 车辆类型 ")
local selectedVehicle2 = 0

local function selectVehicle2(slot, index, name)
    selectedVehicle2 = index
    notification.show(string.format("2号槽位 - 车辆类型: %s", slot, name))
end

menu.add_action(vehicleMenu2, "LM87", function() selectVehicle2(2, 1, "LM87") end)
menu.add_action(vehicleMenu2, "Cinquemila", function() selectVehicle2(2, 2, "Cinquemila") end)
menu.add_action(vehicleMenu2, "Autarch", function() selectVehicle2(2, 3, "Autarch") end)
menu.add_action(vehicleMenu2, "Tigon", function() selectVehicle2(2, 4, "Tigon") end)
menu.add_action(vehicleMenu2, "Champion", function() selectVehicle2(2, 5, "Champion") end)
menu.add_action(vehicleMenu2, "10F", function() selectVehicle2(2, 6, "10F") end)
menu.add_action(vehicleMenu2, "SM722", function() selectVehicle2(2, 7, "SM722") end)
menu.add_action(vehicleMenu2, "Omnis e-GT", function() selectVehicle2(2, 8, "Omnis e-GT") end)
menu.add_action(vehicleMenu2, "Growler", function() selectVehicle2(2, 9, "Growler") end)
menu.add_action(vehicleMenu2, "Deity", function() selectVehicle2(2, 10, "Deity") end)
menu.add_action(vehicleMenu2, "Itali RSX", function() selectVehicle2(2, 11, "Itali RSX") end)
menu.add_action(vehicleMenu2, "Coquette D10", function() selectVehicle2(2, 12, "Coquette D10") end)
menu.add_action(vehicleMenu2, "Jubilee", function() selectVehicle2(2, 13, "Jubilee") end)
menu.add_action(vehicleMenu2, "Astron", function() selectVehicle2(2, 14, "Astron") end)
menu.add_action(vehicleMenu2, "Comet S2 Cabr.", function() selectVehicle2(2, 15, "Comet S2 Cabr.") end)
menu.add_action(vehicleMenu2, "Torero", function() selectVehicle2(2, 16, "Torero") end)
menu.add_action(vehicleMenu2, "Cheetah Classic", function() selectVehicle2(2, 17, "Cheetah Classic") end)
menu.add_action(vehicleMenu2, "Turismo Classic", function() selectVehicle2(2, 18, "Turismo Classic") end)
menu.add_action(vehicleMenu2, "Infernus Classic", function() selectVehicle2(2, 19, "Infernus Classic") end)
menu.add_action(vehicleMenu2, "Stafford", function() selectVehicle2(2, 20, "Stafford") end)
menu.add_action(vehicleMenu2, "GT500", function() selectVehicle2(2, 21, "GT500") end)
menu.add_action(vehicleMenu2, "Viseris", function() selectVehicle2(2, 22, "Viseris") end)
menu.add_action(vehicleMenu2, "Mamba", function() selectVehicle2(2, 23, "Mamba") end)
menu.add_action(vehicleMenu2, "Coquette Black.", function() selectVehicle2(2, 24, "Coquette Black.") end)
menu.add_action(vehicleMenu2, "Stinger GT", function() selectVehicle2(2, 25, "Stinger GT") end)
menu.add_action(vehicleMenu2, "Z-Type", function() selectVehicle2(2, 26, "Z-Type") end)
menu.add_action(vehicleMenu2, "Broadway", function() selectVehicle2(2, 27, "Broadway") end)
menu.add_action(vehicleMenu2, "Vigero ZX", function() selectVehicle2(2, 28, "Vigero ZX") end)
menu.add_action(vehicleMenu2, "Buffalo STX", function() selectVehicle2(2, 29, "Buffalo STX") end)
menu.add_action(vehicleMenu2, "Ruston", function() selectVehicle2(2, 30, "Ruston") end)
menu.add_action(vehicleMenu2, "Gauntl. Hellfire", function() selectVehicle2(2, 31, "Gauntl. Hellfire") end)
menu.add_action(vehicleMenu2, "Dominator GTT", function() selectVehicle2(2, 32, "Dominator GTT") end)
menu.add_action(vehicleMenu2, "Roosevelt Valor", function() selectVehicle2(2, 33, "Roosevelt Valor") end)
menu.add_action(vehicleMenu2, "Swinger", function() selectVehicle2(2, 34, "Swinger") end)
menu.add_action(vehicleMenu2, "Stirling GT", function() selectVehicle2(2, 35, "Stirling GT") end)
menu.add_action(vehicleMenu2, "Omnis", function() selectVehicle2(2, 36, "Omnis") end)
menu.add_action(vehicleMenu2, "Tropos Rallye", function() selectVehicle2(2, 37, "Tropos Rallye") end)
menu.add_action(vehicleMenu2, "Jugular", function() selectVehicle2(2, 38, "Jugular") end)
menu.add_action(vehicleMenu2, "Patriot Mil-Spec", function() selectVehicle2(2, 39, "Patriot Mil-Spec") end)
menu.add_action(vehicleMenu2, "Toros", function() selectVehicle2(2, 40, "Toros") end)
menu.add_action(vehicleMenu2, "Caracara 4x4", function() selectVehicle2(2, 41, "Caracara 4x4") end)
menu.add_action(vehicleMenu2, "Sentinel Classic", function() selectVehicle2(2, 42, "Sentinel Classic") end)
menu.add_action(vehicleMenu2, "Weevil", function() selectVehicle2(2, 43, "Weevil") end)
menu.add_action(vehicleMenu2, "Blista Kanjo", function() selectVehicle2(2, 44, "Blista Kanjo") end)
menu.add_action(vehicleMenu2, "Eudora", function() selectVehicle2(2, 45, "Eudora") end)
menu.add_action(vehicleMenu2, "Kamacho", function() selectVehicle2(2, 46, "Kamacho") end)
menu.add_action(vehicleMenu2, "Hellion", function() selectVehicle2(2, 47, "Hellion") end)
menu.add_action(vehicleMenu2, "Ellie", function() selectVehicle2(2, 48, "Ellie") end)
menu.add_action(vehicleMenu2, "Hermes", function() selectVehicle2(2, 49, "Hermes") end)
menu.add_action(vehicleMenu2, "Hustler", function() selectVehicle2(2, 50, "Hustler") end)
menu.add_action(vehicleMenu2, "Turismo Om.", function() selectVehicle2(2, 51, "Turismo Om.") end)
menu.add_action(vehicleMenu2, "Buffalo EVX", function() selectVehicle2(2, 52, "Buffalo EVX") end)
menu.add_action(vehicleMenu2, "Itali GTO St.", function() selectVehicle2(2, 53, "Itali GTO St.") end)
menu.add_action(vehicleMenu2, "Virtue", function() selectVehicle2(2, 54, "Virtue") end)
menu.add_action(vehicleMenu2, "Ignus", function() selectVehicle2(2, 55, "Ignus") end)
menu.add_action(vehicleMenu2, "Zentorno", function() selectVehicle2(2, 56, "Zentorno") end)
menu.add_action(vehicleMenu2, "Neon", function() selectVehicle2(2, 57, "Neon") end)
menu.add_action(vehicleMenu2, "Furia", function() selectVehicle2(2, 58, "Furia") end)
menu.add_action(vehicleMenu2, "Zorrusso", function() selectVehicle2(2, 59, "Zorrusso") end)
menu.add_action(vehicleMenu2, "Thrax", function() selectVehicle2(2, 60, "Thrax") end)
menu.add_action(vehicleMenu2, "Vagner", function() selectVehicle2(2, 61, "Vagner") end)
menu.add_action(vehicleMenu2, "Panthere", function() selectVehicle2(2, 62, "Panthere") end)
menu.add_action(vehicleMenu2, "Itali GTO", function() selectVehicle2(2, 63, "Itali GTO") end)
menu.add_action(vehicleMenu2, "S80RR", function() selectVehicle2(2, 64, "S80RR") end)
menu.add_action(vehicleMenu2, "Tyrant", function() selectVehicle2(2, 65, "Tyrant") end)
menu.add_action(vehicleMenu2, "Entity MT", function() selectVehicle2(2, 66, "Entity MT") end)
menu.add_action(vehicleMenu2, "Torero XO", function() selectVehicle2(2, 67, "Torero XO") end)
menu.add_action(vehicleMenu2, "Neo", function() selectVehicle2(2, 68, "Neo") end)
menu.add_action(vehicleMenu2, "Corsita", function() selectVehicle2(2, 69, "Corsita") end)
menu.add_action(vehicleMenu2, "Paragon R", function() selectVehicle2(2, 70, "Paragon R") end)
menu.add_action(vehicleMenu2, "Franken Stange", function() selectVehicle2(2, 71, "Franken Stange") end)
menu.add_action(vehicleMenu2, "Comet Safari", function() selectVehicle2(2, 72, "Comet Safari") end)
menu.add_action(vehicleMenu2, "FR36", function() selectVehicle2(2, 73, "FR36") end)
menu.add_action(vehicleMenu2, "Hotring Everon", function() selectVehicle2(2, 74, "Hotring Everon") end)
menu.add_action(vehicleMenu2, "Komoda", function() selectVehicle2(2, 75, "Komoda") end)
menu.add_action(vehicleMenu2, "Tailgater S", function() selectVehicle2(2, 76, "Tailgater S") end)
menu.add_action(vehicleMenu2, "Jester Classic", function() selectVehicle2(2, 77, "Jester Classic") end)
menu.add_action(vehicleMenu2, "Jester RR", function() selectVehicle2(2, 78, "Jester RR") end)
menu.add_action(vehicleMenu2, "Euros", function() selectVehicle2(2, 79, "Euros") end)
menu.add_action(vehicleMenu2, "ZR350", function() selectVehicle2(2, 80, "ZR350") end)
menu.add_action(vehicleMenu2, "Cypher", function() selectVehicle2(2, 81, "Cypher") end)
menu.add_action(vehicleMenu2, "Dominator ASP", function() selectVehicle2(2, 82, "Dominator ASP") end)
menu.add_action(vehicleMenu2, "Baller ST-D", function() selectVehicle2(2, 83, "Baller ST-D") end)
menu.add_action(vehicleMenu2, "Casco", function() selectVehicle2(2, 84, "Casco") end)
menu.add_action(vehicleMenu2, "Drift Yosemite", function() selectVehicle2(2, 85, "Drift Yosemite") end)
menu.add_action(vehicleMenu2, "Everon", function() selectVehicle2(2, 86, "Everon") end)
menu.add_action(vehicleMenu2, "Penumbra FF", function() selectVehicle2(2, 87, "Penumbra FF") end)
menu.add_action(vehicleMenu2, "V-STR", function() selectVehicle2(2, 88, "V-STR") end)
menu.add_action(vehicleMenu2, "Dominator GT", function() selectVehicle2(2, 89, "Dominator GT") end)
menu.add_action(vehicleMenu2, "Schlagen GT", function() selectVehicle2(2, 90, "Schlagen GT") end)
menu.add_action(vehicleMenu2, "Cavalcade XL", function() selectVehicle2(2, 91, "Cavalcade XL") end)
menu.add_action(vehicleMenu2, "Clique", function() selectVehicle2(2, 92, "Clique") end)
menu.add_action(vehicleMenu2, "Boor", function() selectVehicle2(2, 93, "Boor") end)
menu.add_action(vehicleMenu2, "Sugoi", function() selectVehicle2(2, 94, "Sugoi") end)
menu.add_action(vehicleMenu2, "Greenwood", function() selectVehicle2(2, 95, "Greenwood") end)
menu.add_action(vehicleMenu2, "Brigham", function() selectVehicle2(2, 96, "Brigham") end)
menu.add_action(vehicleMenu2, "Issi Rally", function() selectVehicle2(2, 97, "Issi Rally") end)
menu.add_action(vehicleMenu2, "Seminole Fr.", function() selectVehicle2(2, 98, "Seminole Fr.") end)
menu.add_action(vehicleMenu2, "Kanjo SJ", function() selectVehicle2(2, 99, "Kanjo SJ") end)
menu.add_action(vehicleMenu2, "Previon", function() selectVehicle2(2, 100, "Previon") end)


-- Modification (Slot 2)
local modificationMenu2 = menu.add_submenu(slot2, "插槽 2 - 修改 ")
local selectedModification2 = 0
for i = 1, 5 do
    menu.add_action(modificationMenu2, string.format("Version %d", i), function()
        selectedModification2 = i - 1
        notification.show(string.format("[插槽 2] 修改: 版本 %d", i))
    end)
end

-- Claim Car (Slot 2)
local keepMenu2 = menu.add_submenu(slot2, "插槽 2 - 领取汽车 ")
local canKeep2 = 0
menu.add_action(keepMenu2, "设为可索赔 ", function()
    canKeep2 = 1
    notification.show("[插槽 2] 可领取汽车")
end)
menu.add_action(keepMenu2, "设为不可认领 ", function()
    canKeep2 = 0
    notification.show("[插槽 2] 汽车现在不可认领")
end)

-- Apply Button (Slot 2)
menu.add_action(slot2, "插槽 2 - 应用更改 ", function()
    -- Updated globals
    globals.set_int(262145 + 33524 + 2, selectedRobbery2)                             
    globals.set_int(262145 + 33532 + 2, selectedVehicle2 + selectedModification2 * 100) 
    globals.set_bool(262145 + 33528 + 2, canKeep2)                                    

    -- Updated local
    locals.set_int("vehrob_planning", 535, 2)

    notification.show("[插槽 2] 应用已更改")
end)




--- Slot 3
local slot3 = menu.add_submenu(salvagePrepsMenu, "插槽 3 ")

-- Robbery Type (Slot 3)
local robberyMenu3 = menu.add_submenu(slot3, "3号槽-抢劫类型 ")
local selectedRobbery3 = 0
for i, name in ipairs({"Cargo Ship", "帮派分子 ", "杜根 ", "讲台 ", "麦克托尼 "}) do
    menu.add_action(robberyMenu3, name, function()
        selectedRobbery3 = i - 1
        notification.show(string.format("[槽位 3] 抢劫类型: %s", name))
    end)
end

-- Vehicle Type (Slot 3)
local vehicleMenu3 = menu.add_submenu(slot3, "槽位 3 - 车辆类型 ")
local selectedVehicle3 = 0

local function selectVehicle3(slot, index, name)
    selectedVehicle3 = index
    notification.show(string.format("[槽位 %d] 车辆类型: %s", slot, name))
end

menu.add_action(vehicleMenu3, "LM87", function() selectVehicle3(3, 1, "LM87") end)
menu.add_action(vehicleMenu3, "Cinquemila", function() selectVehicle3(3, 2, "Cinquemila") end)
menu.add_action(vehicleMenu3, "Autarch", function() selectVehicle3(3, 3, "Autarch") end)
menu.add_action(vehicleMenu3, "Tigon", function() selectVehicle3(3, 4, "Tigon") end)
menu.add_action(vehicleMenu3, "Champion", function() selectVehicle3(3, 5, "Champion") end)
menu.add_action(vehicleMenu3, "10F", function() selectVehicle3(3, 6, "10F") end)
menu.add_action(vehicleMenu3, "SM722", function() selectVehicle3(3, 7, "SM722") end)
menu.add_action(vehicleMenu3, "Omnis e-GT", function() selectVehicle3(3, 8, "Omnis e-GT") end)
menu.add_action(vehicleMenu3, "Growler", function() selectVehicle3(3, 9, "Growler") end)
menu.add_action(vehicleMenu3, "Deity", function() selectVehicle3(3, 10, "Deity") end)
menu.add_action(vehicleMenu3, "Itali RSX", function() selectVehicle3(3, 11, "Itali RSX") end)
menu.add_action(vehicleMenu3, "Coquette D10", function() selectVehicle3(3, 12, "Coquette D10") end)
menu.add_action(vehicleMenu3, "Jubilee", function() selectVehicle3(3, 13, "Jubilee") end)
menu.add_action(vehicleMenu3, "Astron", function() selectVehicle3(3, 14, "Astron") end)
menu.add_action(vehicleMenu3, "Comet S2 Cabr.", function() selectVehicle3(3, 15, "Comet S2 Cabr.") end)
menu.add_action(vehicleMenu3, "Torero", function() selectVehicle3(3, 16, "Torero") end)
menu.add_action(vehicleMenu3, "Cheetah Classic", function() selectVehicle3(3, 17, "Cheetah Classic") end)
menu.add_action(vehicleMenu3, "Turismo Classic", function() selectVehicle3(3, 18, "Turismo Classic") end)
menu.add_action(vehicleMenu3, "Infernus Classic", function() selectVehicle3(3, 19, "Infernus Classic") end)
menu.add_action(vehicleMenu3, "Stafford", function() selectVehicle3(3, 20, "Stafford") end)
menu.add_action(vehicleMenu3, "GT500", function() selectVehicle3(3, 21, "GT500") end)
menu.add_action(vehicleMenu3, "Viseris", function() selectVehicle3(3, 22, "Viseris") end)
menu.add_action(vehicleMenu3, "Mamba", function() selectVehicle3(3, 23, "Mamba") end)
menu.add_action(vehicleMenu3, "Coquette Black.", function() selectVehicle3(3, 24, "Coquette Black.") end)
menu.add_action(vehicleMenu3, "Stinger GT", function() selectVehicle3(3, 25, "Stinger GT") end)
menu.add_action(vehicleMenu3, "Z-Type", function() selectVehicle3(3, 26, "Z-Type") end)
menu.add_action(vehicleMenu3, "Broadway", function() selectVehicle3(3, 27, "Broadway") end)
menu.add_action(vehicleMenu3, "Vigero ZX", function() selectVehicle3(3, 28, "Vigero ZX") end)
menu.add_action(vehicleMenu3, "Buffalo STX", function() selectVehicle3(3, 29, "Buffalo STX") end)
menu.add_action(vehicleMenu3, "Ruston", function() selectVehicle3(3, 30, "Ruston") end)
menu.add_action(vehicleMenu3, "Gauntl. Hellfire", function() selectVehicle3(3, 31, "Gauntl. Hellfire") end)
menu.add_action(vehicleMenu3, "Dominator GTT", function() selectVehicle3(3, 32, "Dominator GTT") end)
menu.add_action(vehicleMenu3, "Roosevelt Valor", function() selectVehicle3(3, 33, "Roosevelt Valor") end)
menu.add_action(vehicleMenu3, "Swinger", function() selectVehicle3(3, 34, "Swinger") end)
menu.add_action(vehicleMenu3, "Stirling GT", function() selectVehicle3(3, 35, "Stirling GT") end)
menu.add_action(vehicleMenu3, "Omnis", function() selectVehicle3(3, 36, "Omnis") end)
menu.add_action(vehicleMenu3, "Tropos Rallye", function() selectVehicle3(3, 37, "Tropos Rallye") end)
menu.add_action(vehicleMenu3, "Jugular", function() selectVehicle3(3, 38, "Jugular") end)
menu.add_action(vehicleMenu3, "Patriot Mil-Spec", function() selectVehicle3(3, 39, "Patriot Mil-Spec") end)
menu.add_action(vehicleMenu3, "Toros", function() selectVehicle3(3, 40, "Toros") end)
menu.add_action(vehicleMenu3, "Caracara 4x4", function() selectVehicle3(3, 41, "Caracara 4x4") end)
menu.add_action(vehicleMenu3, "Sentinel Classic", function() selectVehicle3(3, 42, "Sentinel Classic") end)
menu.add_action(vehicleMenu3, "Weevil", function() selectVehicle3(3, 43, "Weevil") end)
menu.add_action(vehicleMenu3, "Blista Kanjo", function() selectVehicle3(3, 44, "Blista Kanjo") end)
menu.add_action(vehicleMenu3, "Eudora", function() selectVehicle3(3, 45, "Eudora") end)
menu.add_action(vehicleMenu3, "Kamacho", function() selectVehicle3(3, 46, "Kamacho") end)
menu.add_action(vehicleMenu3, "Hellion", function() selectVehicle3(3, 47, "Hellion") end)
menu.add_action(vehicleMenu3, "Ellie", function() selectVehicle3(3, 48, "Ellie") end)
menu.add_action(vehicleMenu3, "Hermes", function() selectVehicle3(3, 49, "Hermes") end)
menu.add_action(vehicleMenu3, "Hustler", function() selectVehicle3(3, 50, "Hustler") end)
menu.add_action(vehicleMenu3, "Turismo Om.", function() selectVehicle3(3, 51, "Turismo Om.") end)
menu.add_action(vehicleMenu3, "Buffalo EVX", function() selectVehicle3(3, 52, "Buffalo EVX") end)
menu.add_action(vehicleMenu3, "Itali GTO St.", function() selectVehicle3(3, 53, "Itali GTO St.") end)
menu.add_action(vehicleMenu3, "Virtue", function() selectVehicle3(3, 54, "Virtue") end)
menu.add_action(vehicleMenu3, "Ignus", function() selectVehicle3(3, 55, "Ignus") end)
menu.add_action(vehicleMenu3, "Zentorno", function() selectVehicle3(3, 56, "Zentorno") end)
menu.add_action(vehicleMenu3, "Neon", function() selectVehicle3(3, 57, "Neon") end)
menu.add_action(vehicleMenu3, "Furia", function() selectVehicle3(3, 58, "Furia") end)
menu.add_action(vehicleMenu3, "Zorrusso", function() selectVehicle3(3, 59, "Zorrusso") end)
menu.add_action(vehicleMenu3, "Thrax", function() selectVehicle3(3, 60, "Thrax") end)
menu.add_action(vehicleMenu3, "Vagner", function() selectVehicle3(3, 61, "Vagner") end)
menu.add_action(vehicleMenu3, "Panthere", function() selectVehicle3(3, 62, "Panthere") end)
menu.add_action(vehicleMenu3, "Itali GTO", function() selectVehicle3(3, 63, "Itali GTO") end)
menu.add_action(vehicleMenu3, "S80RR", function() selectVehicle3(3, 64, "S80RR") end)
menu.add_action(vehicleMenu3, "Tyrant", function() selectVehicle3(3, 65, "Tyrant") end)
menu.add_action(vehicleMenu3, "Entity MT", function() selectVehicle3(3, 66, "Entity MT") end)
menu.add_action(vehicleMenu3, "Torero XO", function() selectVehicle3(3, 67, "Torero XO") end)
menu.add_action(vehicleMenu3, "Neo", function() selectVehicle3(3, 68, "Neo") end)
menu.add_action(vehicleMenu3, "Corsita", function() selectVehicle3(3, 69, "Corsita") end)
menu.add_action(vehicleMenu3, "Paragon R", function() selectVehicle3(3, 70, "Paragon R") end)
menu.add_action(vehicleMenu3, "Franken Stange", function() selectVehicle3(3, 71, "Franken Stange") end)
menu.add_action(vehicleMenu3, "Comet Safari", function() selectVehicle3(3, 72, "Comet Safari") end)
menu.add_action(vehicleMenu3, "FR36", function() selectVehicle3(3, 73, "FR36") end)
menu.add_action(vehicleMenu3, "Hotring Everon", function() selectVehicle3(3, 74, "Hotring Everon") end)
menu.add_action(vehicleMenu3, "Komoda", function() selectVehicle3(3, 75, "Komoda") end)
menu.add_action(vehicleMenu3, "Tailgater S", function() selectVehicle3(3, 76, "Tailgater S") end)
menu.add_action(vehicleMenu3, "Jester Classic", function() selectVehicle3(3, 77, "Jester Classic") end)
menu.add_action(vehicleMenu3, "Jester RR", function() selectVehicle3(3, 78, "Jester RR") end)
menu.add_action(vehicleMenu3, "Euros", function() selectVehicle3(3, 79, "Euros") end)
menu.add_action(vehicleMenu3, "ZR350", function() selectVehicle3(3, 80, "ZR350") end)
menu.add_action(vehicleMenu3, "Cypher", function() selectVehicle3(3, 81, "Cypher") end)
menu.add_action(vehicleMenu3, "Dominator ASP", function() selectVehicle3(3, 82, "Dominator ASP") end)
menu.add_action(vehicleMenu3, "Baller ST-D", function() selectVehicle3(3, 83, "Baller ST-D") end)
menu.add_action(vehicleMenu3, "Casco", function() selectVehicle3(3, 84, "Casco") end)
menu.add_action(vehicleMenu3, "Drift Yosemite", function() selectVehicle3(3, 85, "Drift Yosemite") end)
menu.add_action(vehicleMenu3, "Everon", function() selectVehicle3(3, 86, "Everon") end)
menu.add_action(vehicleMenu3, "Penumbra FF", function() selectVehicle3(3, 87, "Penumbra FF") end)
menu.add_action(vehicleMenu3, "V-STR", function() selectVehicle3(3, 88, "V-STR") end)
menu.add_action(vehicleMenu3, "Dominator GT", function() selectVehicle3(3, 89, "Dominator GT") end)
menu.add_action(vehicleMenu3, "Schlagen GT", function() selectVehicle3(3, 90, "Schlagen GT") end)
menu.add_action(vehicleMenu3, "Cavalcade XL", function() selectVehicle3(3, 91, "Cavalcade XL") end)
menu.add_action(vehicleMenu3, "Clique", function() selectVehicle3(3, 92, "Clique") end)
menu.add_action(vehicleMenu3, "Boor", function() selectVehicle3(3, 93, "Boor") end)
menu.add_action(vehicleMenu3, "Sugoi", function() selectVehicle3(3, 94, "Sugoi") end)
menu.add_action(vehicleMenu3, "Greenwood", function() selectVehicle3(3, 95, "Greenwood") end)
menu.add_action(vehicleMenu3, "Brigham", function() selectVehicle3(3, 96, "Brigham") end)
menu.add_action(vehicleMenu3, "Issi Rally", function() selectVehicle3(3, 97, "Issi Rally") end)
menu.add_action(vehicleMenu3, "Seminole Fr.", function() selectVehicle3(3, 98, "Seminole Fr.") end)
menu.add_action(vehicleMenu3, "Kanjo SJ", function() selectVehicle3(3, 99, "Kanjo SJ") end)
menu.add_action(vehicleMenu3, "Previon", function() selectVehicle3(3, 100, "Previon") end)


-- Modification (Slot 3)
local modificationMenu3 = menu.add_submenu(slot3, "插槽 3 - 修改 ")
local selectedModification3 = 0
for i = 1, 5 do
    menu.add_action(modificationMenu3, string.format("Version %d", i), function()
        selectedModification3 = i - 1
        notification.show(string.format("[Slot 3] Modification: Version %d", i))
    end)
end

-- Claim Car (Slot 3) --
local keepMenu3 = menu.add_submenu(slot3, "槽位 3 - 领取车辆 ")
local canKeep3 = 0
menu.add_action(keepMenu3, "设为可索赔 ", function()
    canKeep3 = 1
    notification.show("[Slot 3] Car is now claimable")
end)
menu.add_action(keepMenu3, "设为不可认领 ", function()
    canKeep3 = 0
    notification.show("[Slot 3] Car is now unclaimable")
end)

--apply slot3
menu.add_action(slot3, "插槽 3 - 应用更改 ", function()

    globals.set_int(262145 + 33524 + 3, selectedRobbery3)                            
    globals.set_int(262145 + 33532 + 3, selectedVehicle3 + selectedModification3 * 100)
    globals.set_bool(262145 + 33528 + 3, canKeep3) 


    locals.set_int("vehrob_planning", 535, 2) -- Finalize config

    notification.show("[Slot 3] Changes applied ")
end)


menu.add_action(salvagePrepsMenu, "完成任务准备 ", function()


    local stats = {
        "SALV23_GEN_BS",
        "SALV23_SCOPE_BS",
        "SALV23_FM_PROG",
        "SALV23_INST_PROG"
    }

    for _, statName in ipairs(stats) do
        local mp0 = MISC.GET_HASH_KEY("MP0_" .. statName)
        local mp1 = MISC.GET_HASH_KEY("MP1_" .. statName)
        STATS.STAT_SET_INT(mp0, -1, true)
        STATS.STAT_SET_INT(mp1, -1, true)
		notification.show("Completed Preps! :D")
    end
end)


menu.add_action(salvagePrepsMenu, "重新加载任务板 ", function()

    locals.set_int("vehrob_planning", 535, 2)

    notification.show("Reloaded Mission Board")

end)
menu.add_action(salvagePrepsMenu, "重置任务准备 ", function()


    local stats = {
        "SALV23_GEN_BS",
        "SALV23_SCOPE_BS",
        "SALV23_FM_PROG",
        "SALV23_INST_PROG"
    }

    for _, statName in ipairs(stats) do
        local mp0 = MISC.GET_HASH_KEY("MP0_" .. statName)
        local mp1 = MISC.GET_HASH_KEY("MP1_" .. statName)
        STATS.STAT_SET_INT(mp0, 0, true)
        STATS.STAT_SET_INT(mp1, 0, true)
		notification.show("Preps Have Been Reset! :D")
    end
end)

menu.add_toggle(salvagePrepsMenu, "取消设置费 ", false, function(toggle)
    local tunableContext = "VEHROB"
    local tunableName = "SETUP_COST"
    local value = toggle and 0.0 or 20000.0

    tunables.set_int(71522671, value) --need a way to set float

   if toggle then
       notification.show("Setup Fee Has Been Removed")
   else
       notification.show("Setup Price Reset To Default")
   end

    loggedSalvageSetup = toggle
end)

menu.add_action(salvageToolsMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)

-- Slot 1 submenu

menu.add_action(salvageToolsMenu, "移除插槽 1 冷却时间 ", function()
    local stat0 = MISC.GET_HASH_KEY("MP0_SALV23_VEHROB_STATUS0")
    local stat1 = MISC.GET_HASH_KEY("MP1_SALV23_VEHROB_STATUS0")
    STATS.STAT_SET_INT(stat0, 0, true)
    STATS.STAT_SET_INT(stat1, 0, true)
    locals.set_int("vehrob_planning", 535, 2)
    notification.show("[Slot 1] Made Available")
end)

-- Slot 2 submenu


menu.add_action(salvageToolsMenu, "移除插槽 2 冷却时间 ", function()
    local stat0 = MISC.GET_HASH_KEY("MP0_SALV23_VEHROB_STATUS1")
    local stat1 = MISC.GET_HASH_KEY("MP1_SALV23_VEHROB_STATUS1")
    STATS.STAT_SET_INT(stat0, 0, true)
    STATS.STAT_SET_INT(stat1, 0, true)
    locals.set_int("vehrob_planning", 535, 2)
    notification.show("[Slot 2] Made Available")
end)

-- Slot 3 submenu


menu.add_action(salvageToolsMenu, "移除插槽 3 冷却时间 ", function()
    local stat0 = MISC.GET_HASH_KEY("MP0_SALV23_VEHROB_STATUS2")
    local stat1 = MISC.GET_HASH_KEY("MP1_SALV23_VEHROB_STATUS2")
    STATS.STAT_SET_INT(stat0, 0, true)
    STATS.STAT_SET_INT(stat1, 0, true)
    locals.set_int("vehrob_planning", 535, 2)
    notification.show("[Slot 3] Made Available")
end)

menu.add_action(salvageToolsMenu, "绕过无法启动错误 ", function()
	locals.set_int("vehrob_planning", 416, 1)
	locals.set_int("tuner_planning", 406, 2)
	notification.show("Removed Error")
end)

--instant finish Salvage Yard (all missions)

menu.add_action(salvageToolsMenu, "立即完成废品场抢劫 ", function()
    local heists = {
        CargoShip = {
            scriptName = "fm_content_vehrob_cargo_ship",
            step1 = 7163 + 1,
            step2 = 7308 + 1249
        },
        Gangbanger = {
            scriptName = "fm_content_vehrob_police",
            step1 = 8989 + 1,
            step2 = 9122 + 1305
        },
        Duggan = {
            scriptName = "fm_content_vehrob_arena",
            step1 = 7894 + 1,
            step2 = 8014 + 1314
        },
        Podium = {
            scriptName = "fm_content_vehrob_casino_prize",
            step1 = 9163 + 1,
            step2 = 9300 + 1258
        },
        McTony = {
            scriptName = "fm_content_vehrob_submarine",
            step1 = 6198 + 1,
            step2 = 6336 + 1159
        }
    }

    local bitToSet = (1 << 11)
    local finished = false

    for name, info in pairs(heists) do
        if script.is_active(info.scriptName) then
            local currentVal = locals.get_int(info.scriptName, info.step1)
            locals.set_int(info.scriptName, info.step1, currentVal | bitToSet)
            locals.set_int(info.scriptName, info.step2, 2)

            notification.show("立刻完成抢劫")
            finished = true
            break
        end
    end

    if not finished then
        notification.show("No Salvage Yard heist script is active")
    end
end)

-- Slot 1 sell value variable
local slot1SellValue = globals.get_int(262145 + 33536 + 1) or 0
menu.add_int(slot1, "设置出售价值槽 1 ", "slot1_sell_value", 0, 2100000, 10000, function(val)
    slot1SellValue = val
end)
menu.add_action(slot1, "应用销售价值槽 1 ", function()
    globals.set_int(262145 + 33536 + 1, slot1SellValue)
	locals.set_int("vehrob_planning", 535, 2)
    notification.show("Sell value applied (Slot 1): " .. slot1SellValue)
end)

-- Slot 2 sell value variable
local slot2SellValue = globals.get_int(262145 + 33536 + 2) or 0
menu.add_int(slot2, "设置出售价值槽 2 ", "slot2_sell_value", 0, 2100000, 10000, function(val)
    slot2SellValue = val
end)
menu.add_action(slot2, "应用出售价值槽 2 ", function()
    globals.set_int(262145 + 33536 + 2, slot2SellValue)
	locals.set_int("vehrob_planning", 535, 2)
    notification.show("Sell value applied (Slot 2): " .. slot2SellValue)
end)

-- Slot 3 sell value variable
local slot3SellValue = globals.get_int(262145 + 33536 + 3) or 0
menu.add_int(slot3, "设置出售价值槽 3 ", "slot3_sell_value", 0, 2100000, 10000, function(val)
    slot3SellValue = val
end)
menu.add_action(slot3, "应用出售价值槽 3 ", function()
    globals.set_int(262145 + 33536 + 3, slot3SellValue)
	locals.set_int("vehrob_planning", 535, 2)
    notification.show("Sell value applied (Slot 3): " .. slot3SellValue)
end)

-- Agency




local selectedContractIndex = 3 -- Default to "None"

local function selectContract(index, name)
    selectedContractIndex = index
    notification.show(string.format("Selected Contract: %s", name))
end

menu.add_action(contractsMenu, "None", function() selectContract(3, "None") end)
menu.add_action(contractsMenu, "Nightclub", function() selectContract(4, "Nightclub") end)
menu.add_action(contractsMenu, "码头 ", function() selectContract(12, "Marina") end)
menu.add_action(contractsMenu, "夜生活泄漏 ", function() selectContract(28, "Nightlife Leaks ") end)
menu.add_action(contractsMenu, "乡村俱乐部 ", function() selectContract(60, "Country Club ") end)
menu.add_action(contractsMenu, "宾客名单 ", function() selectContract(123, "Guest List ") end)
menu.add_action(contractsMenu, "高社会泄漏 ", function() selectContract(254, "High Soc. Leak ") end)
menu.add_action(contractsMenu, "戴维斯 ", function() selectContract(508, "Davis ") end)
menu.add_action(contractsMenu, "巴拉斯", function() selectContract(1020, "Ballas ") end)
menu.add_action(contractsMenu, "南方中心泄漏 ", function() selectContract(2044, "Sou. Cen. Leak ") end)
menu.add_action(contractsMenu, "工作室时间 ", function() selectContract(2045, "Studio Time ") end)
menu.add_action(contractsMenu, "不要#W. Dre ", function() selectContract(4095, "Don't # W. Dre ") end)

menu.add_action(agencyPrepsMenu, "完成准备并申请合同 ", function()
    -- Get active character slot (0 or 1)
    local mpx = PLAYER.GET_PLAYER_INDEX()
    local prefix = "MP" .. mpx .. "_"

    -- Set contract ID
    local contractHash = MISC.GET_HASH_KEY(prefix .. "FIXER_STORY_BS")
    STATS.STAT_SET_INT(contractHash, selectedContractIndex, true)

    -- Determine strand value based on contract index
    local strand = -1
    if selectedContractIndex < 18 then
        strand = 0
    elseif selectedContractIndex < 128 then
        strand = 1
    elseif selectedContractIndex < 2044 then
        strand = 2
    end

    -- Set FIXER_STORY_STRAND
    local strandHash = MISC.GET_HASH_KEY(prefix .. "FIXER_STORY_STRAND")
    STATS.STAT_SET_INT(strandHash, strand, true)

    -- Set GENERAL_BS and COMPLETED_BS to -1
    local generalHash = MISC.GET_HASH_KEY(prefix .. "FIXER_GENERAL_BS")
    local completedHash = MISC.GET_HASH_KEY(prefix .. "FIXER_COMPLETED_BS")
    STATS.STAT_SET_INT(generalHash, -1, true)
    STATS.STAT_SET_INT(completedHash, -1, true)

    notification.show("Applied Contract And Completed Preps, Change Session To Apply")
end)


menu.add_action(agencyToolsMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)




menu.add_action(agencyToolsMenu, "设置最大支出使用在任务开始 ", function()
    globals.set_int(262145 + 31249, 2500000)
    notification.show("Max Payout $2,500,000 Has Been set :D")
end)




menu.add_action(agencyToolsMenu, " 移除事务所任务冷却 ", function()
    local charIndex = globals.get_int(1574927) or 0
    if charIndex ~= 1 then charIndex = 0 end  -- Only 0 or 1 allowed
    local prefix = "MP" .. tostring(charIndex) .. "_"

    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "FIXER_STORY_COOLDOWN_POSIX"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "FIXER_SECURITY_CONTRACT_COOLDOWN_TIME"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "REQUEST_FRANKLIN_PAYPHONE_HIT_COOLDOWN"), 0, true)

    notification.show("Removed Cooldown")
end)

menu.add_action(agencyToolsMenu, "跳过检查点", function()
    local offset = 20391 + 2
	local offset1 = 54763 + 2
    local bitToSet = (1 << 17)
	

    local currentVal = locals.get_int("fm_mission_controller", offset)
    locals.set_int("fm_mission_controller", offset, currentVal | bitToSet)
	local currentVal = locals.get_int("fm_mission_controller_2020", offset)
    locals.set_int("fm_mission_controller_2020", offset1, currentVal | bitToSet)

    notification.show("正在跳过检查点...")
end)


menu.add_action(agencyToolsMenu, "即时完成机构 ", function()

    local script_name = "fm_mission_controller_2020"
    network.force_script_host("fm_mission_controller_2020")
    script.yield(1000)


    local base = 54763
    local step1_offset = base + 1589
    local step2_offset = base + 1776 + 1
    local step3_offset = base + 1


    locals.set_int(script_name, step1_offset, 5)

 
    locals.set_int(script_name, step2_offset, 999999)


    local value = locals.get_int(script_name, step3_offset)
    value = value | (1 << 9)
    value = value | (1 << 16)
    locals.set_int(script_name, step3_offset, value)

    notification.show("Instant Finished Agency Finale")
end)



-- AutoShop

local selectedContract = -1 -- default "None"

local autoShopContracts = {
    { name = "None",            index = -1 },
    { name = "联合储蓄银行 ",  index = 0  },
    { name = "超级美元交易 ",  index = 1  },
    { name = "银行合同 ",   index = 2  },
    { name = "ECU 工作 ",         index = 3  },
    { name = "监狱契约 ", index = 4  },
    { name = "代理交易 ",     index = 5  },
    { name = "合同遗失 ",   index = 6  },
    { name = "数据契约 ",   index = 7  }
}

local function apply_and_complete_auto_shop()
    if selectedContract < 0 then
        notification.show("No valid contract selected to apply.")
        return
    end

    local activeChar = globals.get_int(1574927, true, 3, 0) or 0
    

    local prefix = ("MP%d_"):format(activeChar)
    local statTunerCurrent = prefix .. "TUNER_CURRENT"
    local statTunerGenBs = prefix .. "TUNER_GEN_BS"

    local hashTunerCurrent = MISC.GET_HASH_KEY(statTunerCurrent)
    local hashTunerGenBs = MISC.GET_HASH_KEY(statTunerGenBs)

    STATS.STAT_SET_INT(hashTunerCurrent, selectedContract, true)

    local gen_bs_value = (selectedContract == 1) and 4351 or 12543
    STATS.STAT_SET_INT(hashTunerGenBs, gen_bs_value, true)

    locals.set_int("tuner_planning", 406, 2)

    notification.show("Applied Contract And Skipped Preps")
end


-- Add contract selection actions
for _, contract in ipairs(autoShopContracts) do
    menu.add_action(autoshopcontractsmenu, contract.name, function()
        selectedContract = contract.index
        notification.show(string.format("Selected contract: %s", contract.name))
    end)
end

-- Add button to apply selected contract
menu.add_action(autoshopPrepsMenu, "跳过准备并申请合同 ", function()
    apply_and_complete_auto_shop()  -- 
end)

menu.add_action(autoshopPrepsMenu, "重置抢劫计划版 ", function()
    locals.set_int("tuner_planning", 406, 2)

    notification.show("Board Has Been Redrawn")
end)


menu.add_action(autoshopToolMenu, "跳过过场", function()
    CUTSCENE.STOP_CUTSCENE_IMMEDIATELY()
    notification.show("已跳过过场")
end)


menu.add_action(autoshopToolMenu, "跳过检查点", function()
    local offset = 20391 + 2
	local offset1 = 54763 + 2
    local bitToSet = (1 << 17)
	

    local currentVal = locals.get_int("fm_mission_controller", offset)
    locals.set_int("fm_mission_controller", offset, currentVal | bitToSet)
	local currentVal = locals.get_int("fm_mission_controller_2020", offset)
    locals.set_int("fm_mission_controller_2020", offset1, currentVal | bitToSet)

    notification.show("正在跳过检查点...")
end)

menu.add_action(autoshopToolMenu, "一键完成改装铺抢劫任务", function()
    -- Force script host for fm_mission_controller
    network.force_script_host("fm_mission_controller_2020")
    script.yield(1000)

    -- Set finish
    locals.set_int("fm_mission_controller_2020", 54763 + 1, 51338977)
    locals.set_int("fm_mission_controller_2020", 54763 + 1776 + 1, 101) 



    notification.show("立刻完成抢劫")
end)

-- Current payout amount (default 1M)
local payout = 1000000


menu.add_int(autoshopmoneyMenu, "支付金额", 0, 0, 2200000, 100000, function(val)
    payout = val
    notification.show("金额已设定为 $" .. val)
end)

-- Button: Set to max (2M) without applying
menu.add_action(autoshopmoneyMenu, "最大金额 (不会应用)", function()
    payout = 2200000
    notification.show("已选择最大金额. 记得去应用!")
end)

-- Button: Apply payout to all 8 tunables and sets fee to 0
menu.add_action(autoshopmoneyMenu, "应用金额 (当任务开始的时候使用)", function()
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD0"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD1"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD2"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD3"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD4"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD5"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD6"), payout)
    tunables.set_int(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD7"), payout)
	locals.set_int("tuner_planning", 406, 2)

    notification.show("已应用金额: $" .. payout)
	notification.show(tostring(util.joaat("TUNER_ROBBERY_LEADER_CASH_REWARD0")))

end)

menu.add_action(autoshopmoneyMenu, "最大分红不适用于联合储蓄任务")



--- Cayo (crash)
menu.add_action(cayoMenu, "最高分红为 $2,550,000")
local function unlockAllCayoPOI()
    -- mp0 character (player 0)
-- MP0 (Character 0)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_H4CNF_BS_GEN"), -1, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_H4CNF_BS_ENTR"), 63, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_H4CNF_BS_ABIL"), 63, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_H4CNF_APPROACH"), -1, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP0_H4_PLAYTHROUGH_STATUS"), 10, true)
locals.set_int("heist_island_planning", 1568, 2)

-- MP1 (Character 1)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_H4CNF_BS_GEN"), -1, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_H4CNF_BS_ENTR"), 63, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_H4CNF_BS_ABIL"), 63, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_H4CNF_APPROACH"), -1, true)
STATS.STAT_SET_INT(MISC.GET_HASH_KEY("MP1_H4_PLAYTHROUGH_STATUS"), 10, true)
locals.set_int("heist_island_planning", 1568, 2)


    notification.show("已解锁所有兴趣点")
end

menu.add_action(cayoprepsMenu, "解锁所有兴趣点", unlockAllCayoPOI)

local selectedDifficulty = 126823

local difficulties = {
    {name = "Normal", index = 126823},
    {name = "Hard", index = 131055}
}

for _, diff in ipairs(difficulties) do
    menu.add_action(difficultyMenu, diff.name, function()
        selectedDifficulty = diff.index
        notification.show("Selected Difficulty: " .. diff.name)
    end)
end

local selectedApproach = 65535

local approaches = {
    {name = "Kosatka", index = 65283},
    {name = "阿尔科诺斯特", index = 65413},
    {name = "Velum", index = 65289},
    {name = "隐形歼灭者 ", index = 65425},
    {name = "巡逻艇", index = 65313},
    {name = "Longfin", index = 65345},
    {name = "所有方式", index = 65535}
}

for _, approach in ipairs(approaches) do
    menu.add_action(approachMenu, approach.name, function()
        selectedApproach = approach.index
        notification.show("Selected Approach: " .. approach.name)
    end)
end

local selectedLoadout = 1

local loadouts = {
    {name = "Aggressor", index = 1},
    {name = "Conspirator", index = 2},
    {name = "价值MK2 卡宾枪", index = 3},
    {name = "Saboteur", index = 4},
    {name = "Marksman", index = 5}
}

for _, loadout in ipairs(loadouts) do
    menu.add_action(loadoutMenu, loadout.name, function()
        selectedLoadout = loadout.index
        notification.show("Selected Loadout: " .. loadout.name)
    end)
end

local selectedTarget = 5

local targets = {
    {name = "龙舌兰酒", index = 0},
    {name = "Ruby Necklace", index = 1},
    {name = "Bearer Bonds", index = 2},
    {name = "Pink Diamond", index = 3},
	{name = "Madrazo Files", index = 4},
    {name = "Panther Statue", index = 5}
}

for _, target in ipairs(targets) do
    menu.add_action(targetMenu, target.name, function()
        selectedTarget = target.index
        notification.show("Selected Primary Target: " .. target.name)
    end)
end

-- Selected Target Holders
local selectedCompoundTarget = "GOLD"
local selectedIslandTarget = "GOLD"

-- Loot Types
local secondaryTargets = {
    {name = "空白", index = "NONE"},
    {name = "现金", index = "CASH"},
    {name = "大麻", index = "WEED"},
    {name = "可卡因", index = "COKE"},
    {name = "黄金", index = "GOLD"}
}

-- Compound Target Menu
for _, target in ipairs(secondaryTargets) do
    menu.add_action(secondaryMenu, target.name, function()
        selectedCompoundTarget = target.index
        notification.show("Selected Compound Target: " .. target.name)
    end)
end

-- Island Target Menu
for _, target in ipairs(secondaryTargets) do
    menu.add_action(islandTargetMenu, target.name, function()
        selectedIslandTarget = target.index
        notification.show("Selected Island Target: " .. target.name)
    end)
end


local selectedCompoundAmount = 255

local compoundAmounts = {
    {name = "空的", index = 0},
    {name = "满的", index = 255},
    {name = "1", index = 128},
    {name = "2", index = 64},
    {name = "3", index = 196},
    {name = "4", index = 204},
    {name = "5", index = 220},
    {name = "6", index = 252},
    {name = "7", index = 253}
}

for _, amount in ipairs(compoundAmounts) do
    menu.add_action(compoundAmountMenu, amount.name, function()
        selectedCompoundAmount = amount.index
        notification.show("Selected Compound Amount: " .. amount.name)
    end)
end


local selectedIslandAmount = 16777215

local islandAmounts = {
    {name = "空的", index = 0},
    {name = "满的", index = 16777215},
    {name = "1", index = 8388608},
    {name = "2", index = 12582912},
    {name = "3", index = 12845056},
    {name = "4", index = 12976128},
    {name = "5", index = 13500416},
    {name = "6", index = 14548992},
    {name = "7", index = 16646144},
    {name = "8", index = 16711680},
    {name = "9", index = 16744448},
    {name = "10", index = 16760832},
    {name = "11", index = 16769024},
    {name = "12", index = 16769536},
    {name = "13", index = 16770560},
    {name = "14", index = 16770816},
    {name = "15", index = 16770880},
    {name = "16", index = 16771008},
    {name = "17", index = 16773056},
    {name = "18", index = 16777152},
    {name = "19", index = 16777184},
    {name = "20", index = 16777200},
    {name = "21", index = 16777202},
    {name = "22", index = 16777203},
    {name = "23", index = 16777211}
}

for _, amount in ipairs(islandAmounts) do
    menu.add_action(islandAmountMenu, amount.name, function()
        selectedIslandAmount = amount.index
        notification.show("Selected Island Amount: " .. amount.name)
    end)
end

local selectedArtsAmount = 127

local artsAmounts = {
    {name = "Empty", index = 0},
    {name = "Full", index = 127},
    {name = "1", index = 64},
    {name = "2", index = 96},
    {name = "3", index = 112},
    {name = "4", index = 120},
    {name = "5", index = 122},
    {name = "6", index = 126}
}

for _, amount in ipairs(artsAmounts) do
    menu.add_action(artsAmountMenu, amount.name, function()
        selectedArtsAmount = amount.index
        notification.show("Selected Arts Amount: " .. amount.name)
    end)
end
local cashValue = 83250
local weedValue = 135000
local cokeValue = 202500
local goldValue = 333333
local artsValue = 180000



menu.add_int(LootOptionsMenu, "现金价值", cashValue, 83250, 2550000, 50000, function(value)
    cashValue = value
    
end)

menu.add_int(LootOptionsMenu, "大麻价值", weedValue, 135000, 2550000, 50000, function(value)
    weedValue = value
    
end)

menu.add_int(LootOptionsMenu, "可卡因价值", cokeValue, 202500, 2550000, 50000, function(value)
    cokeValue = value
    
end)

menu.add_int(LootOptionsMenu, "黄金价值", goldValue, 333333, 2550000, 50000, function(value)
    goldValue = value
    
end)

menu.add_int(LootOptionsMenu, "艺术价值", artsValue, 180000, 2550000, 50000, function(value)
    artsValue = value
    
end)




local function MPX()
    local charIndex = globals.get_int(1574927)
    return "MP" .. tostring(charIndex) .. "_"
end

local function applyPreps(
    selectedDifficulty, selectedApproach, selectedLoadout,
    selectedTarget,
    selectedCompoundTarget, selectedCompoundAmount, selectedArtsAmount,
    selectedIslandTarget, selectedIslandAmount,
    cashValue, weedValue, cokeValue, goldValue, artsValue)

    local prefix = MPX()

    -- General Setup
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_PROGRESS"), selectedDifficulty, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_MISSIONS"), selectedApproach, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_WEAPONS"), selectedLoadout, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_TARGET"), selectedTarget, true)

    -- Compound Loot
    local lootTypes = {"CASH", "WEED", "COKE", "GOLD"}
    for _, loot in ipairs(lootTypes) do
        local value = (selectedCompoundTarget == loot) and selectedCompoundAmount or 0
        STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_" .. loot .. "_C"), value, true)
        STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_" .. loot .. "_C_SCOPED"), value, true)
    end

    -- Island Loot
    for _, loot in ipairs(lootTypes) do
        local value = (selectedIslandTarget == loot) and selectedIslandAmount or 0
        STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_" .. loot .. "_I"), value, true)
        STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_" .. loot .. "_I_SCOPED"), value, true)
    end

    -- Paintings
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_PAINT"), selectedArtsAmount or 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_PAINT_SCOPED"), selectedArtsAmount or 0, true)

    -- Loot Values
    local lootValues = {
        CASH = cashValue,
        WEED = weedValue,
        COKE = cokeValue,
        GOLD = goldValue,
    }

    for loot, value in pairs(lootValues) do
        local hasLoot = (selectedCompoundTarget == loot or selectedIslandTarget == loot)
        STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_" .. loot .. "_V"), hasLoot and value or 0, true)
    end

    -- Painting Value
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4LOOT_PAINT_V"), selectedArtsAmount > 0 and artsValue or 0, true)

    -- Optional Gear/Disruption
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_UNIFORM"), -1, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_GRAPPEL"), -1, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_TROJAN"), 5, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_WEP_DISRP"), 3, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_ARM_DISRP"), 3, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_HEL_DISRP"), 3, true)

    -- Trigger Save
    locals.set_int("heist_island_planning", 1568, 2)

    notification.show("已应用并完成佩里科岛抢劫的准备!")
end

-- Button to Apply Preps
menu.add_action(cayoprepsMenu, "应用准备", function()
    applyPreps(
        selectedDifficulty,
        selectedApproach,
        selectedLoadout,
        selectedTarget,
        selectedCompoundTarget,
        selectedCompoundAmount,
        selectedArtsAmount,
        selectedIslandTarget,
        selectedIslandAmount,
        cashValue,
        weedValue,
        cokeValue,
        goldValue,
        artsValue
    )
end)



local function MPX()
    local charIndex = globals.get_int(1574927)
    return "MP" .. tostring(charIndex) .. "_"
end

-- Reset all Cayo Perico prep stats
local function reset_cayo_preps()
    local prefix = MPX()

    -- Full heist stat reset
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_PROGRESS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_MISSIONS"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_APPROACH"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_TARGET"), -1, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_BS_GEN"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_BS_ENTR"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4CNF_BS_ABIL"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_PLAYTHROUGH_STATUS"), 0, true)

    -- Set local to force reload 
    locals.set_int("heist_island_planning", 1568, 2)

    notification.show("佩里科岛抢劫准备已重置")
end


menu.add_action(cayoprepsMenu, "重置准备", function()
    reset_cayo_preps()
end)


menu.add_action(cayotoolsMenu, "重新加载计划屏幕", function()
    locals.set_int("heist_island_planning", 1568, 2)
    notification.show("已重新加载计划屏幕")
end)




menu.add_action(cayotoolsMenu, "绕过指纹破解", function()
    locals.set_int("fm_mission_controller_2020", 25460, 5)
    notification.show("已绕过指纹破解")
end)

menu.add_action(cayotoolsMenu, "无冷却切割主要目标玻璃 ", function()
    locals.set_float("fm_mission_controller_2020", 31525 + 3, 100.0)
    notification.show("已绕过主要目标玻璃切割冷却时间")
end)

menu.add_action(cayotoolsMenu, "一键切割排水管 ", function()
    locals.set_int("fm_mission_controller_2020", 30285, 6)
    notification.show("已切割排水管")
end)


local function MPX()
    local charIndex = globals.get_int(1574927)
    return "MP" .. tostring(charIndex) .. "_"
end

menu.add_action(cayotoolsMenu, "移除单人冷却时间 ", function()
    local prefix = MPX()
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_TARGET_POSIX"), 1659643454, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_COOLDOWN"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_COOLDOWN_HARD"), 0, true)
    notification.show(" 移除团队冷却时间 ")
end)

menu.add_action(cayotoolsMenu, "移除团队冷却时间 ", function()
    local prefix = MPX()
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_TARGET_POSIX"), 1659429119, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_COOLDOWN"), 0, true)
    STATS.STAT_SET_INT(MISC.GET_HASH_KEY(prefix .. "H4_COOLDOWN_HARD"), 0, true)
    notification.show("Removed Team Cooldown")
end)

menu.add_action(cayotoolsMenu, "一键完成佩里克岛抢劫 ", function()
    -- Force script host
    network.force_script_host("fm_mission_controller_2020")
    script.yield(1000)


    locals.set_int("fm_mission_controller_2020", 54763, 9)             
    locals.set_int("fm_mission_controller_2020", 54763 + 1776 + 1, 50) 

    notification.show("立刻完成抢劫")
end)


local cayoP1Cut = 100
local cayoP2Cut = 100
local cayoP3Cut = 100
local cayoP4Cut = 100

menu.add_int(cayoCutsMenu, "玩家1分红 %", 100, 0, 1000, 25, function(val)
    cayoP1Cut = val
end)

menu.add_int(cayoCutsMenu, "玩家2分红  %", 100, 0, 1000, 25, function(val)
    cayoP2Cut = val
end)

menu.add_int(cayoCutsMenu, "玩家3分红  %", 100, 0, 1000, 25, function(val)
    cayoP3Cut = val
end)

menu.add_int(cayoCutsMenu, "玩家4分红  %", 100, 0, 1000, 25, function(val)
    cayoP4Cut = val
end)

menu.add_action(cayoCutsMenu, "应用分红", function()
    globals.set_int(1975799 + 831 + 56 + 1, cayoP1Cut)
    globals.set_int(1975799 + 831 + 56 + 2, cayoP2Cut)
    globals.set_int(1975799 + 831 + 56 + 3, cayoP3Cut)
    globals.set_int(1975799 + 831 + 56 + 4, cayoP4Cut)
    notification.show("佩里克岛抢劫分红已应用")
end)




menu.add_action(cayoCutsMenu, "强制玩家准备（佩里克岛抢劫）", function()
    -- Force script host
    network.force_script_host("fm_mission_controller_2020")
    script.yield(1000)

    -- Force Player 
    globals.set_int(1976911 + 1 + (1 * 27) + 7 + 1, 1)
	globals.set_int(1976911 + 1 + (1 * 27) + 7 + 2, 1) 
    globals.set_int(1976911 + 1 + (2 * 27) + 7 + 3, 1) 
    globals.set_int(1976911 + 1 + (3 * 27) + 7 + 4, 1) 

    notification.show("所有人已经强制准备就绪")
end)